
cheez3d
Members-
Posts
290 -
Joined
-
Last visited
Everything posted by cheez3d
-
Stop any other resource that might handle the spawning (like freeroam) and in meta.xml use the value "gamemode" for the attribute type of the info node. <info author="Someone" name="Something" description="" type="gamemode" version="1"/>
-
SERVER SIDE addEventHandler("onPlayerJoin",root,function() fadeCamera(source,false,0) end) addEvent("onPlayerFilesDownloaded",true) addEventHandler("onPlayerFilesDownloaded",root,function() spawnPlayer(source,0,0,0) end) CLIENT SIDE addEventHandler("onClientResourceStart",resourceRoot,function() fadeCamera(true) triggerServerEvent("onPlayerFilesDownloaded",localPlayer) end)
-
local shootingAllowed = false function playerSpawn() setTimer(function() shootingAllowed = true end,10000,1) end addEventHandler("onClientPlayerSpawn", getLocalPlayer(), playerSpawn) function doShoot() if shootingAllowed == true then if not isPlayerDead(getLocalPlayer()) then shootingAllowed = false local theVehicle = getPedOccupiedVehicle(getLocalPlayer()) local x,y,z = getElementPosition(theVehicle) local rX,rY,rZ = getElementRotation(theVehicle) local x = x+4*math.cos(math.rad(rZ+90)) local y = y+4*math.sin(math.rad(rZ+90)) createProjectile(theVehicle, 19, x, y, z, 1.0, nil) setTimer(allowShooting, 3000, 1) end end end function allowShooting() shootingAllowed = true end for keyName, state in pairs(getBoundKeys("fire")) do bindKey(keyName, "down", doShoot) end
-
You can check if the player is holding down the Right Mouse Button (if I remember correctly, you can only use the special fighting style only when you hold down RMB) and use toggleControl() when it's being holded. If you disable the "enter_exit" control permanently you will also not be able to enter/exit vehicles.
-
Why are you doing it like that when I provided you with a faster and easier code?
-
-- SERVER_SIDE addEventHandler("onPlayerLogin",function(_,account) local player_data = {wins = getAccountData( account, "Wins" ) or 0,deaths = getAccountData( account, "Deaths" ) or 0,hunt = getAccountData( account, "Hunters" ) or 0,expp = getAccountData( account, "EXP" ) or 0,money = getAccountData( account, "Cash" ) or 0,map = getAccountData( account, "Maps" ) or 0,buymap = getAccountData( account, "BuyMaps" ) or 0,luck = getAccountData( account, "Lucky" ) or 0,sound = getAccountData( account, "Sound" ) or 0} -- lets create a table with all the player data in it setElementData(source,"data",player_data) -- attach the table to the player using setElementData end) -- CLIENT_SIDE for data,value in pairs (getElementData(localPlayer,"data")) do -- element data is synced between client and server -- your code end
-
local language_handler = function(_,language,...) local text = table.concat({...}," ") outputChatBox("["..language.."] "..getPlayerName(localPlayer)..": "..text,root,255,255,255,true) end addCommandHandler("language",language_handler) bindKey("l","down","chatbox","language",guiComboBoxGetItemText(guiComboBoxGetSelected(--[[your_combo_box]])))
-
addEventHandler("onClientResourceStart",resourceRoot,function() fadeCamera(true) end)
-
local pickup = createPickup(2487.1398925781,-1667.7604980469,13.34375,3,1273,0) addEventHandler("onPickupHit",pickup,function(player) setElementData(player,"used_pickup",true) outputChatBox("Propriedades: Digite /comprar",player) end) addCommandHandler("comprar",function(player) if getElementData(player,"used_pickup") then takePlayerMoney(player,50) end end)
-
addEventHandler("onClientGUIClick",spawn,function() local x,y,z = getElementPosition(localPlayer) local id = guiGridListGetItemText(GUIEditor.gridlist[1],guiGridListGetSelectedItem(GUIEditor.gridlist[1]),1) guiSetVisible(GUIEditor.window[1],false) showCursor(false) outputChatBox("You selected "..vehicle..".",localPlayer) local vehicle = createVehicle(tonumber(id),x,y,z,0,0,90) if tonumber(id) == 560 then setVehicleColor(vehicle,0,128,255) end end,false)
-
Bad idea to execute a loop every second.
-
And where exactly is thePlayer defined in your code?
-
Your code conains a lot of mistakes and errors. What are you exactly trying to do? Add 5 health points to the player every second? If yes then use a setTimer.
-
addEventHandler("onPickupHit",createPickup(2507.1298828125,-1701.2734375,14.508857727051,3,1247,25000),function(player) if getPlayerWantedLevel(player)>0 then setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) end end)
-
local pickup_positions = { {0,0,0}, {1,1,1} } for _,pos in ipairs (pickup_positions) do local pickup = createPickup(pos[1],pos[2],pos[3],3,1247) addEventHandler("onPickupHit",pickup,function(player) setPlayerWantedLevel(player,getPlayerWantedLevel(player)+1) destroyElement(source) givePlayerMoney(player,100) end) end
-
FROM VERSION 1.4 r4973 ONWARDS getEventHandlers() https://wiki.multitheftauto.com/wiki/GetEventHandlers
-
local screen_width,screen_height = guiGetScreenSize() local visibility = false local function render_handler() dxDrawRectangle((screen_width-507)/2,(screen_height-300)/2, 507, 300, tocolor(0, 0, 0, 155), true) dxDrawRectangle((screen_width-507)/2, (screen_height-29)/2, 507, 29, tocolor(248, 6, 6, 143), true) dxDrawText("USER PANEL",(screen_width-711)/2,(screen_height-234)/2, 711, 234, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, true, false, false) end addEventHandler("onClientResourceStart",resourceRoot,function() bindKey("F7","down",function() local handler = not visibility and addEventHandler or removeEventHandler visibility = not visibility handler("onClientRender",root,render_handler) end) end)
-
local jail_positions = { {1577.7109375, -1634.638671875, 548.15625}, {1577.3759765625, -1640.029296875, 548.15625}, {1577.7900390625, -1644.529296875, 548.15625} } local random_room = math.random(1,#jail_positions) setElementPosition(player,jail_positions[random_room][1],jail_positions[random_room][2],jail_positions[random_room][3])
-
local function render_handler() dxDrawRectangle(204, 234, 507, 300, tocolor(0, 0, 0, 155), true) dxDrawRectangle(204, 205, 507, 29, tocolor(248, 6, 6, 143), true) dxDrawText("USER PANEL", 203, 204, 711, 234, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, true, false, false) end addEventHandler("onClientResourceStart",resourceRoot,function() bindKey("F7","down",function() addEventHandler("onClientRender",root,render_handler) end) bindKey("F7","up",function() removeEventHandler("onClientRender",root,render_handler) end) end)
-
The policeWindow is only valid inside the first function as it is a local variable and I do NOT suggest making it a global variable. Try to rethink your functions.
-
createBlip(1177.5682373047,-1323.2587890625,14.077121734619,22,root) createBlip(1607.1494140625,1819.6416015625,10.828001022339,22,root) createBlip(-2654.5205078125,638.2412109375,14.453125,22,root) local spawn_locations = { {1177.5682373047,-1323.2587890625,14.077121734619,-2584.6865234375,568.95703125,40.101623535156,-2654.5205078125,638.2412109375 , 14.453125}, {1607.1494140625,1819.6416015625 ,10.828001022339,1581.2802734375,1853.708984375,30.209064483643,1607.1494140625,1819.6416015625,10.828001022339}, {-2654.5205078125,638.2412109375,14.453125,1208.8115234375,-1287.755859375,38.246742248535,1177.5682373047,-1323.2587890625,14.077121734619} } addEventHandler("onPlayerWasted",root,function() local list = {} local x,y,z = getElementPosition(source) for _,location in ipairs (spawn_locations) do local dist = getDistanceBetweenPoints3D(x,y,z,location[1],location[2],location[3]) list[dist] = location end table.sort(list) setTimer(function() setCameraMatrix(source,list[4],list[5],list[6],list[7],list[8],list[9]) spawnPlayer(source,list[1][1],list[1][2],list[1][3]) setTimer(setCameraTarget,15000,1,source,source) end,1500,1) end)
-
createBlip(1177.5682373047,-1323.2587890625,14.077121734619,22,root) createBlip(1607.1494140625,1819.6416015625,10.828001022339,22,root) createBlip(-2654.5205078125,638.2412109375,14.453125,22,root) local spawn_locations = { {1177.5682373047,-1323.2587890625,14.077121734619}, {1607.1494140625,1819.6416015625 ,10.828001022339}, {-2654.5205078125,638.2412109375,14.453125} } addEventHandler("onPlayerWasted",root,function() local list = {} local x,y,z = getElementPosition(source) for _,location in ipairs (spawn_locations) do local dist = getDistanceBetweenPoints3D(x,y,z,location[1],location[2],location[3]) list[dist] = location end table.sort(list) setTimer(spawnPlayer,1500,1,source,list[1][1],list[1][2],list[1][3]) end)
-
Give the resource ACL privileges.
-
There were some bugs in the code. Copy it again, I updated it.