Apo Posted October 12, 2016 Share Posted October 12, 2016 hi in need call911 and set wanted for jacked local call = {} function vehicleExitJack ( thePlayer, seat, jacked ) if jacked then call[thePlayer] = true setTimer ( kill911, 60000, 1, thePlayer ) end end addEventHandler ( "onVehicleExit", getRootElement(), vehicleExitJack ) function kill911 (thePlayer) call[thePlayer] = false end function call911(thePlayer) if call[thePlayer] == true then setPlayerWantedLevel ( jacked, 6 ) end end addCommandHandler("call911",call911) Link to comment
Adolfram Posted October 12, 2016 Share Posted October 12, 2016 jacked is not defined in call911 function and i don't think it's a good idea to overwrite call function. you might want to change the table name to wantedPlayers or something Link to comment
Walid Posted October 12, 2016 Share Posted October 12, 2016 (edited) Call it's an mta sa function local theTable = {} function vehicleExitJack (thePlayer, seat, jacker) if jacker then theTable[thePlayer] = jacker end end addEventHandler ("onVehicleExit",root, vehicleExitJack) function call911(thePlayer) if isElement(theTable[thePlayer]) then setPlayerWantedLevel (theTable[thePlayer], 6) theTable[thePlayer] = nil end end addCommandHandler("call911",call911) Edited October 12, 2016 by Walid Link to comment
shaio Posted October 12, 2016 Share Posted October 12, 2016 (edited) local wanted = {} function vehicleExitJack(player,seat,jacked) if jacked then wanted[player] = {level = 6} setTimer(kill911,60000,1,player) end end addEventHandler("onVehicleExit",getRootElement(),vehicleExitJack) function setWanted(player,otherPlayer) if wantedPlayers == true then local wantedPlayer = getPlayerFromName(otherPlayer) setPlayerWantedLevel(wantedPlayer,6) wanted[player] = {level = 6} setTimer(kill911,60000,1,wantedPlayer) end end addCommandHandler("911",setWanted) function updateWanted() for i,plr in pairs(getElementsByType("player")) do if wanted[plr] then setPlayerWantedLevel(plr,wanted[plr].level) end end end setTimer(updateWanted,1000,0) function kill911(player) wanted[player] = nil end Made this simple code for you, so that the player gets a wanted level when he/she is in a stolen vehicle, or called on at 911, and they cannot get out of it. Edited October 12, 2016 by shaio Link to comment
Apo Posted October 13, 2016 Author Share Posted October 13, 2016 all not work guys in need setwanted for jaked by command 911 if player jacked other player in car Link to comment
Walid Posted October 13, 2016 Share Posted October 13, 2016 2 minutes ago, Apo said: all not work guys in need setwanted for jaked by command 911 if player jacked other player in car try my code Link to comment
Apo Posted October 13, 2016 Author Share Posted October 13, 2016 (edited) 13 hours ago, Walid said: Call it's an mta sa function local theTable = {} function vehicleExitJack (thePlayer, seat, jacker) if jacker then theTable[thePlayer] = jacker end end addEventHandler ("onVehicleExit",root, vehicleExitJack) function call911(thePlayer) if isElement(theTable[thePlayer]) then setPlayerWantedLevel (theTable[thePlayer], 6) theTable[thePlayer] = nil end end addCommandHandler("call911",call911) not work i am call911 and no give wanted for jaker Edited October 13, 2016 by Apo Link to comment
Walid Posted October 13, 2016 Share Posted October 13, 2016 16 minutes ago, Apo said: not work i am call911 and no give wanted for jaker /debugscript 3 Link to comment
Apo Posted October 13, 2016 Author Share Posted October 13, 2016 48 minutes ago, Walid said: /debugscript 3 not error Link to comment
quindo Posted October 13, 2016 Share Posted October 13, 2016 (edited) Shouldn't it be: if theTable[thePlayer] == 'jacker' then setPlayerWantedLevel (thePlayer, 6) instead of: if isElement(theTable[thePlayer]) then setPlayerWantedLevel (theTable[thePlayer], 6) edit: I read it wrong, ignore. Edited October 13, 2016 by quindo My bad Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now