Jump to content

JuniorMelo

Members
  • Posts

    120
  • Joined

  • Last visited

Everything posted by JuniorMelo

  1. local areanumber = getElementData (source,"areanumber") local ganginfo = getgangInfo(getPlayergang(hitElement)) local gangname = ganginfo['gangname'] local dbName = "VOLT_3" .. gangname .. "_members2" local players = executeSQLQuery("SELECT * FROM ?", dbName) maxPlayers = 2 for i,k in ipairs (getElementsByType ( "radararea" )) do local number = getElementData ( k, "areanumber" ) if ( number == areanumber ) then for t, k in ipairs(players) do if tonumber(t) <= tonumber(maxPlayers) then outputChatBox ( '#ff4444[ERROR]#ffffff It is necessary ' .. maxPlayers ..'',thePlayer, 255, 255, 255, true ); return end end end end I'm trying to do this, But I'm not sure if it will work properly. (It takes a number of players within the area to initiate an attack on the area) Sorry for my English, I'm brazilian
  2. local areanumber = getElementData (source,"areanumber") for i,k in ipairs (getElementsByType ( "radararea" )) do local number = getElementData ( k, "areanumber" ) if ( number == areanumber ) then for i, v in ipairs(getElementsByType ( "player" )) do outputChatBox ( ''..i..'', thePlayer, 255, 255, 255, true ) end end end such that ?
  3. You can count how many players are in a radar area ?
  4. It works this way. thx thx local ran = math.random(#Citys[city]) local x, y, z = Citys[city][ran].x, Citys[city][ran].y, Citys[city][ran].z
  5. hello, I have a bug in this function, not creating this marker in the city that the player is. Citys = {} markerPizza = createMarker( 2485.0024414063, 2022.3449707031, 9.8203125, "cylinder", 1.5, 255, 180, 0, 100) blipPizza = createBlipAttachedTo( markerPizza, 14, 2, 255, 255, 0, 255 ) Citys["Los Santos"] = { {x=2382.4638671875, y=-1891.9400634766, z=13.38914680481}, } Citys["San Fierro"] = { {x=-2686.283203125, y=270.83374023438, z=4.3359375}, } Citys["Las Venturas"] = { {x=2445.8454589844, y=2020.6320800781, z=10.8203125}, } function onPizzaMarkerHit(hitPlayer) Citys[i] = { x=x, y=y, z=z } local xx, yy, zz = getElementPosition ( localPlayer ) local city = getZoneName(xx, yy, zz, true) local x, y, z = Citys[city].x, Citys[city].y, Citys[city].z local marker = createMarker(x, y, z, "cylinder", 2, 255, 188, 0) local blip = createBlip(x, y, z, 24, 1) if isElement(markerPizza) then destroyElement(markerPizza) end if isElement(blipPizza) then destroyElement(blipPizza) end addEventHandler("onClientMarkerHit", marker, function() fadeCamera(false) setTimer(fadeCamera, 2000, 1, true) triggerServerEvent("EndJob", localPlayer, localPlayer, elements) end) end addEventHandler("onClientMarkerHit", markerPizza, onPizzaMarkerHit)
  6. very much to everyone, it helped greatly Citizen: very well explained
  7. hello, I wanted to know if I can use this function this way ? getPlayerCount, dimension 2 ====count players in dimension 2==== addEvent("text", true) addEventHandler("text", getRootElement(), function() for k,v in ipairs(getElementsByType("player")) do if getElementDimension ( v ) == 2 then local Count = getPlayerCount(v) setElementData(source,"players",Count) end end end)
  8. Thx Tosfera, this way is more practical and simple
  9. hello, table is just blocking 'Console' is not to block other words, Can anyone tell me why sorry my bad english noTeams = { "Console", "Admin", "Moderator", "SuperModerator" } function create( player, commandName, teamName ) if teamName ~= noTeams[1] and noTeams[2] then local gang = createTeam( teamName ) if (gang) then setPlayerTeam( player, gang ) setTeamColor ( gang, math.random(0,255), math.random(0,255), math.random(0,255) ) outputChatBox( getPlayerName(player) .." #677079Create team #0084FF" ..teamName, getRootElement(), 255, 255, 255,true, thePlayer ) end else outputChatBox("#A020F0[Gang] #ffffffERROR.",thePlayer,255,255,255,true) end end addCommandHandler("gang", create )
  10. this way does not work. I believe it is for an event , "onClientGUIClick" , triggerServerEvent("Ativo", getLocalPlayer(), getLocalPlayer(), Ativo); --Event Give Car triggerServerEvent("Garagem", getLocalPlayer(), getLocalPlayer(), Garagem); --Event Destroy Car ori9 = on; --dxDrawImage ON ori9 = off; -- dxDrawImage OFF
  11. No Have erros in /debugscript 3 function guiPart() f1 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3-47,okX-70, recY-375, "", false) f2 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3-2,okX-70, recY-375, "F2", false) f3 = guiCreateButton(logX-recX/2+(recX-cancelX-okX+375), logY+fAltUser*2+sep*3+43,okX-70, recY-375, "F2", false) guiSetAlpha ( f1, 0 ) guiSetAlpha ( f2, 0 ) guiSetAlpha ( f3, 0 ) end function MouseClick(button,state) if button == "left" and state == "down" then if ( source == f1 ) then triggerServerEvent("Ativo", getLocalPlayer(), getLocalPlayer(), Ativo) --Event GiveCar ori9 = on --Image ON else triggerServerEvent("Garagem", getLocalPlayer(), getLocalPlayer(), Garagem) --Event Destroy Car ori9 = off --image OFF end end end addEventHandler("onClientClick",getRootElement(),MouseClick)
  12. hello, I have this function that is not working , function MouseClick(button,state) if button == "left" and state == "down" then if ( source == f1 ) then triggerServerEvent("Ativo", getLocalPlayer(), getLocalPlayer(), Ativo) ori9 = on else triggerServerEvent("Garagem", getLocalPlayer(), getLocalPlayer(), garagem) ori9 = off end end end addEventHandler("onClientClick",getRootElement(),MouseClick)
  13. Hello,I have a doubt... it is possible to create a function that activates other functions randomly, using math.random Example local functions = {function1, function2} function reboot() for i,player in ipairs(getElementsByType("player")) do randomfunctions = math.random(#functions) setTimer( randomfunctions, 1000, 1, player ) end end function function1(player) end function function2(player) end
  14. you mean like this table is null function spawn(player) local xml = xmlLoadFile("data.xml") spawns = {{}} if xml then for k,v in ipairs (xmlNodeGetChildren(xmlFindChild(xml,"Local",0)))do local posX,posY,posZ = xmlNodeGetAttribute(v,"posX"),xmlNodeGetAttribute(v,"posY"),xmlNodeGetAttribute(v,"posZ") table.insert(spawns, {posX,posY,posZ}) spawns[i] = { posX,posY,posZ } local rnd = math.random(#spawns) spawnPlayer( player, spawns[rnd].posX, spawns[rnd].posY, spawns[rnd].posZ, 90 ) fadeCamera(player, true) setCameraTarget(player, player) end end end
  15. hello, I have a problem in this function, math.random in spawnPlayer I've never heard it, ??? Vector3 ??? Sorry my english function spawn(player) xml = xmlLoadFile("data.xml") if xml then children = xmlFindChild ( xml, "Local", 0 ) if children then for i,v in ipairs(xmlNodeGetChildren(children)) do posX = xmlNodeGetAttribute(v,"posX") posY = xmlNodeGetAttribute(v,"posY") posZ = xmlNodeGetAttribute(v,"posZ") local spawns = {posX,posY,posZ} local rnd = math.random( #spawns ) spawnPlayer( player, spawns[rnd].posX, spawns[rnd].posY, spawns[rnd].posZ, 90 ) fadeCamera(player, true) setCameraTarget(player, player) end xmlUnloadFile(xml) end end end
  16. is possible to use the event addEventHandler("onMapStarting", getRootElement(),updatePlayerLogin)
  17. OHHHHHHHhhhhhhhhhhhhhhhhhhhhhhh Castillo thank you, thank you even needed that!!!
  18. New function, no working function buyCarColor(thePlayer,red,green,blue) local account = getPlayerAccount(thePlayer) if not (isGuestAccount(account)) then setAccountData(account,"firstRed",red) setAccountData(account,"firstGreen",green) setAccountData(account,"firstBlue",blue) outputChatBox("#00ff00[sHOP] #ffffff---!",thePlayer,255,255,255,true) local PVeh = getPedOccupiedVehicle(thePlayer) setVehicleColor(PVeh,red,green,blue) end end function callClientFunction(client, funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end -- If the clientside event handler is not in the same resource, replace 'resourceRoot' with the appropriate element triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {})) end function callServerFunction(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end addEvent("onClientCallsServerFunction", true) addEventHandler("onClientCallsServerFunction", resourceRoot , callServerFunction) function updatePlayerLogin(thePlayer) local account = getPlayerAccount(thePlayer) red = getAccountData(account,"firstRed") green = getAccountData(account,"firstGreen") blue = getAccountData(account,"firstBlue") local PVeh = getPedOccupiedVehicle(thePlayer) setVehicleColor(PVeh,red,green,blue) end addEventHandler("onPlayerLogin", getRootElement(),updatePlayerLogin) Debugscript 3
  19. this function that you sent me, * health * Saves the health of player ?
  20. You should have used executeSQLQuery Could you give me an example this function?
×
×
  • Create New...