-
Posts
1,491 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Walid
-
-- Client side addEventHandler("onClientResourceStart",resourceRoot, function() triggerServerEvent( "clientReady", resourceRoot ) end ) teamplayer = createTeam("Jugadores", 255, 255, 255) addEvent("clientReady", true ) addEventHandler("clientReady",resourceRoot, function() local account = getPlayerAccount(client) local accountName = getAccountName(account) if not isObjectInACLGroup("user."..accountName, aclGetGroup("Anarguia")) or not isObjectInACLGroup("user."..accountName, aclGetGroup("Alianza")) then setPlayerTeam(client, teamplayer) end end )
-
just use this when the player get new points you don't need to use setElementData: function addPlayerDriftScore(player, drifttype, amount) if (isElement(player) and tostring(drifttype)) then local account = getPlayerAccount(player) if (isGuestAccount(account)) then return end local current = getAccountData(account, tostring(drifttype)) or 0 setAccountData(account, tostring(drifttype), current + amount) end end
-
i already gave him the same answer here
-
simply you need to do something like this last points + new points (onPlayerQuit) Example : -- Server side addEventHandler ("onPlayerQuit", root, function () local account = getPlayerAccount (source) if not isGuestAccount (account) then local anterior = getElementData(source, "Last Drift") addPlayerDriftScore(source, "Last Drift", tonumber(anterior)) end end) function addPlayerDriftScore(player, drifttype, amount) if (isElement(player) and drifttype) then local account = getPlayerAccount(player) if (isGuestAccount(account)) then return end local current = getAccountData(account, drifttype) or 0 setAccountData(account, drifttype, current + amount) end end untested but it should work fine
-
Try to use this addEventHandler("onPlayerDamage",root, function(attacker, weapon) if weapon == 8 and getElementType ( source ) == "ped" then if (getElementData (source, "zombie") == true) then killPed(source,attacker,weapon) end end end)
-
Bro you need to Contact the server staff, not MTA team.
-
Try to use my solution here , WhoAmI already gave it to you
-
[quote name=..&G:..]It works now, dunno what I did wrong though Thanks for help You are welcome
-
You can use something like this addEventHandler("onVehicleDamage",root, function (loss) setElementHealth(source, 1000) setVehicleDamageProof(source, true) end )
-
Are u sure that You didn't edit the code: Try this one local state = 0 local distance = 50 function openGarageGate(thePlayer, cmd, garageID, state) if not garageID then outputChatBox("SYNTAXA: /"..cmd.." [iD Garage]", thePlayer, 255, 255, 0) else local garageID = tonumber(garageID) local found = false for i, v in ipairs (getElementsByType("object")) do if (getElementModel(v) == 17950) then local gate = getElementData(v, "poarta") local dbid = tonumber(getElementData(v, "dbid")) if (dbid == garageID) then local px,py,pz = getElementPosition(thePlayer) local ox,oy,oz = getElementPosition(v) if getDistanceBetweenPoints3D(ox,oy,oz,px,py,pz) <= distance then if (state == 0) then local gateX, gateY, gateZ, rotX, roxY, rotZ = getElementAttachedOffsets(gate) setElementAttachedOffsets(gate, gateX, gateY-1, gateZ+1.65, rotX, -90, rotZ) state = 1 outputChatBox("You opened the garage!", thePlayer, 0, 255, 0) found = true break elseif (state == 1) then local gateX, gateY, gateZ, rotX, roxY, rotZ = getElementAttachedOffsets(gate) setElementAttachedOffsets(gate, gateX, gateY+1, gateZ-1.65, rotX, 0, rotZ) state = 0 outputChatBox("You closed the garage!", thePlayer, 0, 255, 0) end else outputChatBox("You are too far away from the garage!", thePlayer, 255, 0, 0) end end end end end if found == false then outputChatBox("There's no garage with this ID!", thePlayer, 255, 0, 0) end end addCommandHandler("opengarage", openGarageGate)
-
Ok try this local state = 0 local distance = 50 function openGarageGate(thePlayer, garageID) local garageID = tonumber(garageID) local found = false for i, v in ipairs (getElementsByType("object")) do if (getElementModel(v) == 17950) then local gate = getElementData(v, "poarta") local dbid = tonumber(getElementData(v, "dbid")) if (dbid == garageID) then found = true break local px,py,pz = getElementPosition(thePlayer) local ox,oy,oz = getElementPosition(v) if getDistanceBetweenPoints3D(ox,oy,oz,px,py,pz) <= distance then local gateX, gateY, gateZ, rotX, roxY, rotZ = getElementAttachedOffsets(gate) if (state == 0) then setElementAttachedOffsets(gate, gateX, gateY-1, gateZ+1.65, rotX, -90, rotZ) outputChatBox("You opened the garage!", thePlayer, 0, 255, 0) state = 1 elseif (state == 1) then setElementAttachedOffsets(gate, gateX, gateY+1, gateZ-1.65, rotX, 0, rotZ) outputChatBox("You closed the garage!", thePlayer, 0, 255, 0) state = 0 end else outputChatBox("You are too far away from the garage!", thePlayer, 255, 0, 0) end end end end if found == false then outputChatBox("There's no garage with this ID!", thePlayer, 255, 0, 0) end end
-
lol ??? why he need to use this Man use createMarker and it will be visible for all players createMarker()
-
Done local state = 0 local distance = 50 function openGarageGate(thePlayer, cmd, garageID, state) if not garageID then outputChatBox("SYNTAXA: /"..cmd.." [iD Garage]", thePlayer, 255, 255, 0) else local garageID = tonumber(garageID) for i, v in ipairs (getElementsByType("object")) do if (getElementModel(v) == 17950) then local gate = getElementData(v, "poarta") local dbid = tonumber(getElementData(v, "dbid")) if (dbid == garageID) then local px,py,pz = getElementPosition(thePlayer) local ox,oy,oz = getElementPosition(v) if getDistanceBetweenPoints3D(ox,oy,oz,px,py,pz) <= distance then if (state == 0) then local gateX, gateY, gateZ, rotX, roxY, rotZ = getElementAttachedOffsets(gate) setElementAttachedOffsets(gate, gateX, gateY-1, gateZ+1.65, rotX, -90, rotZ) outputChatBox("You opened the garage!", thePlayer, 0, 255, 0) state = 1 elseif (state == 1) then local gateX, gateY, gateZ, rotX, roxY, rotZ = getElementAttachedOffsets(gate) setElementAttachedOffsets(gate, gateX, gateY+1, gateZ-1.65, rotX, 0, rotZ) outputChatBox("You closed the garage!", thePlayer, 0, 255, 0) state = 0 end else outputChatBox("You are too far away from the garage!", thePlayer, 255, 0, 0) end else outputChatBox("There's no garage with this ID!", thePlayer, 255, 0, 0) end end end end end addCommandHandler("opengarage", openGarageGate)
-
Try this : local screenWidth, screenHeight = guiGetScreenSize ( ) local h = 1050 function YourCode () dxDrawRectangle(screenWidth*(0/1366),screenHeight*(h/768),screenWidth*(<<< size >>>/1366),screenHeight*(<<< size >>>/768),colors[1]) h = h - 1 if ( h <= - 1050 ) then h = 1050 end end addEventHandler("onClientRender", root, YourCode) Change <<< size >>> with your code numbers.
-
[quote name=..&G:..]It worked, thanks a lot! You are welcome
-
[quote name=..&G:..]It says that I am too far away from the garage ok local state = 0 local distance = 50 function openGarageGate(thePlayer, cmd, garageID, state) if not garageID then outputChatBox("SYNTAXA: /"..cmd.." [iD Garage]", thePlayer, 255, 255, 0) else local garageID = tonumber(garageID) local found = false for i, v in ipairs (getElementsByType("object")) do if (getElementModel(v) == 17950) then local gate = getElementData(v, "poarta") local dbid = tonumber(getElementData(v, "dbid")) if (dbid == garageID) then local px,py,pz = getElementPosition(thePlayer) local ox,oy,oz = getElementPosition(v) if getDistanceBetweenPoints3D(ox,oy,oz,px,py,pz) <= distance then if (state == 0) then local gateX, gateY, gateZ, rotX, roxY, rotZ = getElementAttachedOffsets(gate) setElementAttachedOffsets(gate, gateX, gateY-1, gateZ+1.65, rotX, -90, rotZ) state = 1 outputChatBox("You opened the garage!", thePlayer, 0, 255, 0) found = true break elseif (state == 1) then local gateX, gateY, gateZ, rotX, roxY, rotZ = getElementAttachedOffsets(gate) setElementAttachedOffsets(gate, gateX, gateY+1, gateZ-1.65, rotX, 0, rotZ) outputChatBox("You closed the garage!", thePlayer, 0, 255, 0) end else outputChatBox("You are too far away from the garage!", thePlayer, 255, 0, 0) end end end end end if found == false then outputChatBox("There's no garage with this ID!", thePlayer, 255, 0, 0) end end addCommandHandler("opengarage", openGarageGate)
-
Try this : local state = 0 local distance = 50 function openGarageGate(thePlayer, cmd, garageID, state) if not garageID then outputChatBox("SYNTAXA: /"..cmd.." [iD Garage]", thePlayer, 255, 255, 0) else local garageID = tonumber(garageID) local found = false for i, v in ipairs (getElementsByType("object")) do if (getElementModel(v) == 17950) then local gate = getElementData(v, "poarta") local dbid = tonumber(getElementData(v, "dbid")) if (dbid == garageID) then local px,py,pz = getElementPosition(thePlayer) local ox,oy,oz = getElementPosition(v) if getDistanceBetweenPoints3D(ox,oy,oz,px,py,pz) <= distance then if (state == 0) then local gateX, gateY, gateZ, rotX, roxY, rotZ = getElementAttachedOffsets(gate) setElementAttachedOffsets(gate, gateX, gateY-1, gateZ+1.65, rotX, -90, rotZ) state = 1 outputChatBox("You opened the garage!", thePlayer, 0, 255, 0) found = true break elseif (state == 1) then local gateX, gateY, gateZ, rotX, roxY, rotZ = getElementAttachedOffsets(gate) setElementAttachedOffsets(gate, gateX, gateY+1, gateZ-1.65, rotX, 0, rotZ) outputChatBox("You closed the garage!", thePlayer, 0, 255, 0) end end else outputChatBox("You are too far away from the garage!", thePlayer, 255, 0, 0) end end end end if found == false then outputChatBox("There's no garage with this ID!", thePlayer, 255, 0, 0) end end end addCommandHandler("opengarage", openGarageGate)
-
try this triggerClientEvent(readyPlayerList,"onSetOwner",root, areia.nome, a.owner, areia.preco, areia.x, areia.y, areia.z, a.corR, a.corG, a.corB)
-
use upgrade all type upgrade all in your console then click enter
-
ok all what you need to do is -- Client side addEventHandler("onClientResourceStart",resourceRoot, function() triggerServerEvent( "clientReady", resourceRoot ) end ) -- Server side readyPlayerList = {} addEvent("clientReady", true ) addEventHandler("clientReady",resourceRoot, function() table.insert( readyPlayerList, client ) createNew() end ) addEventHandler("onPlayerQuit",root, function() table.removevalue( readyPlayerList, source ) end ) -- Your function function createNew() for _, areia in pairs ( radar_table ) do pesq = executeSQLQuery("SELECT * FROM `area` WHERE `nome`=?", areia.nome ) for k, a in ipairs (pesq) do triggerClientEvent(readyPlayerList,"onSetOwner",readyPlayerList, areia.nome, a.owner, areia.preco, areia.x, areia.y, areia.z, a.corR, a.corG, a.corB) end end end -- table.removevalue function, in case you don't already have it function table.removevalue(t, val) for i,v in ipairs(t) do if v == val then table.remove(t, i) return i end end return false end