Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. @Agon:He's talking about a Police ticket system, not for lottery. Also it's: getPlayerName not getPlayerFromName to get a player name.
  2. You forgot about 'source'. addEventHandler('onPlayerWasted',root, function() showPlayerHudComponent(source,'all',false) end)
  3. -- client side: local marker = createMarker (1605.600, -1625.300, 12.5, "cylinder", 2, 25, 50, 255, 255 ) local cars = { [596] = 'Police LS', [597] = 'Police SF', [598] = 'Police LV', [599] = 'Police Ranger' } window = guiCreateWindow(561,187,260,388,"Spawn Vehicle",false) guiWindowSetSizable(window,false) spawnButton = guiCreateButton(26,317,96,37,"Spawn",false,window) closeButton = guiCreateButton(142,318,96,37,"Close",false,window) carGrid = guiCreateGridList(23,34,210,249,false,window) guiGridListSetSelectionMode(carGrid,0) column = guiGridListAddColumn(carGrid,"Vehicle name",0.85) for id,vehName in ipairs(cars) do local row = guiGridListAddRow ( carGrid ) guiGridListSetItemText ( carGrid, row, column, tostring(vehName), false, false ) guiGridListSetItemData ( carGrid, row, column, tonumber(id), false, false ) end function showWindow() local playerTeam = getPlayerTeam (localPlayer) local teamName = getTeamName ( playerTeam ) if (teamName == "Police") then guiSetVisible( window, true ) showCursor(true) end end addEventHandler ("onClientMarkerHit", marker, showWindow) function spawn() local row,col = guiGridListGetSelectedItem(carGrid) if (row and col and row ~= -1 and col ~= -1) then local model = guiGridListGetItemData(carGrid, row, 1) triggerServerEvent('onGUIClick',localPlayer,tonumber(model)) end end addEventHandler('onClientGUIClick',spawnButton, spawn, false) function setVisible() guiSetVisible(window,false) showCursor(false) end addEvent('setGUIVisible',true) addEventHandler('setGUIVisible',root,setVisible) function closeWindow() guiSetVisible(window,false) showCursor(false) end addEventHandler ("onClientGUIClick", closeButton, closeWindow, false) -- server side: function spawnVeh(model) local uTeam = getPlayerTeam( source ) if (uTeam and getTeamName ( uTeam ) == 'Police') then local x, y, z = getElementPosition(source) local rot = getPedRotation(source) local theVehicle = createVehicle (model, x, y, z, 0, 0, rot) warpPedIntoVehicle(source,theVehicle) triggerClientEvent('setGUIVisible',source) end end addEvent('onGUIClick',true) addEventHandler('onGUIClick',root,spawnVeh)
  4. Pictures taken from the Camera are stored in a different place, but you can use the function: takePlayerScreenShot to take them as screenshots when use the camera.
  5. Es que no lees todo el post? Luego de 6 segundos la funcion: outputChatBox se ejecuta.
  6. Los timers se ejecutan cada X milisegundos. Por ejemplo: addCommandHandler("prueba", function (elJugador) setTimer(outputChatBox,6000,1,getPlayerName(elJugador) .." Hola Mundo!") end ) Cuando el jugador use el comando "/prueba" creara un timer de 6 segundos que se ejecutara solo UNA vez para enviar un mensaje al chat.
  7. That's just a mess, I suggest you to go back to the wiki and learn properly how to make it.
  8. Castillo

    DirectX Anim

    You're welcome. P.S: To make a DX animation you can create a GUI with alpha 0 and animate it with Client animation library by arc_ Then use the position, size for your DX.
  9. Castillo

    DirectX Anim

    You can create your own GUI fonts with this function: guiCreateFont ([url=https://wiki.multitheftauto.com/wiki/GuiCreateFont]https://wiki.multitheftauto.com/wiki/GuiCreateFont[/url])
  10. No, we are here to help, not to give you the finished script.
  11. addCommandHandler ( "nos", function ( thePlayer, commandName, id ) if ( isPedInVehicle ( thePlayer ) ) then local id = tonumber ( id ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) local playerTeam = getPlayerTeam ( thePlayer ) if (not playerTeam) then return end local name = getTeamName ( playerTeam ) if (name == "Owner" or name == "Admin") then local success = addVehicleUpgrade ( theVehicle, 1010 ) if ( success ) then outputChatBox ( getVehicleUpgradeSlotName ( 1010 ) .. " upgrade added.", thePlayer ) else outputChatBox ( "Failed to add upgrade.", thePlayer ) end end else outputChatBox ( "You must be in a vehicle!", thePlayer ) end end )
  12. It's on "race/race_client.lua".
  13. And you can stop being "noob" by learning, do you think I was born with my knowledge? no, I learned everything I know by myself, you can do the same. We're not helping you when we give the working script.
  14. You don't want me to tell you, you want me to make it for you. Is not that easy, you'll have to change many things, because guiCreateColorLabel returns a table of gui-labels, not just one.
  15. Oh, so you think by just copy and paste the function in your script it'll magically work? Seriously, go back to the wiki and start learning from the basics.
  16. addCommandHandler ( "vr", function ( thePlayer ) local theVehicle = getPedOccupiedVehicle(thePlayer) if ( theVehicle ) then fixVehicle ( theVehicle ) end end )
  17. Have you implemented the function? if so, post your script in pastebin.com and post the link.
  18. There are examples in the wiki, just read them and learn how to do it.
  19. Yes, you can create a MySQL login system with the DB functions.
  20. Castillo

    team set

    Is the team called "OwnerTeam"? or just "Owner"? if so, rename it in the script.
  21. race has a function which removes HEX colors, they shouldn't appear.
  22. I suggest you to use the new DB functions instead, as far as I know, they are better, and easier to use (at least for me). https://wiki.multitheftauto.com/wiki/DbConnect
  23. I sometimes wonder if people is just stupid or blind. I even leaved the highlighting to the function, you just had to scroll down the code. function guiCreateColorLabel(ax, ay, bx, by,str, parent, bool) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 local labels = {} while s do if cap == "" and col then r,g,b = tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)) end if (s ~= 1) or cap ~= "" then local w = dxGetTextWidth(cap) lbl = guiCreateLabel(ax, ay, ax + w, by,cap,parent, bool) table.insert(labels, lbl) if (r == nil) then r = 255 end if (g == nil) then g = 255 end if (b == nil) then b = 255 end guiLabelSetColor(lbl,r,g,b) ax = ax + w r,g,b = tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)) end last = e + 1 s, e, cap, col = str:find(pat, last) end if (last <= #str) then cap = str:sub(last) local w = dxGetTextWidth(cap) lbl2 = guiCreateLabel(ax, ay, ax + w, by,cap,parent, bool) table.insert(labels, lbl2) guiLabelSetColor(lbl2,r,g,b) end return labels end
  24. WHAT?! that's not even Lua, I said around the forums not in Google viewtopic.php?f=91&t=40275&p=408868&hilit=guiCreateColorLabel#p408868
×
×
  • Create New...