abdalbaset Posted January 8, 2014 Share Posted January 8, 2014 i have jail syetem but this jail system Depends on number i set(how much time player stay in the jail)but i need function to make player whene he have highter wanted poinet get more time in jail and if possible tell me how to make timer showed in the screen here script note:this scripts didnt made by me function aplayerdied( ammo, attacker, weapon, bodypart ) local glevel = getPlayerWantedLevel ( source ) if isElement(attacker) then local wlevel = getPlayerWantedLevel( source ) if wlevel > 0 then if getElementParent(attacker) == kingCOP then setPlayerWantedLevel( source, 0 ) end end if ( getElementType( attacker ) == "player" ) then local wlevel = getPlayerWantedLevel( attacker ) if wlevel < 6 then setPlayerWantedLevel( attacker, wlevel+1 ) end elseif ( getElementType( attacker ) == "vehicle" ) then thekiller = getVehicleController( attacker ) if isElement(thekiller) then local wlevel = getPlayerWantedLevel ( thekiller ) if wlevel < 6 then setPlayerWantedLevel( thekiller, wlevel+1 ) end end end end setPlayerWantedLevel( source, 0 ) end addEventHandler ( "onPlayerWasted", getRootElement(), aplayerdied ) --WANTED LEVEL IF A POLICE OFFICER IS ATTACKED function assaultinganofficer ( attacker, weapon, bodypart, loss ) if getElementParent(source) == kingCOP then if isElement(attacker) then if ( getElementType( attacker ) == "player" ) then if getElementParent(attacker) == kingCOP then return end elseif ( getElementType( attacker ) == "vehicle" ) then thedriver = getVehicleController( attacker ) if isElement(thedriver) then if getElementParent(thedriver) == kingCOP then return end end end if (getElementData ( source, "justdamaged" ) ~= "yes") and (source ~= attacker) then setElementData ( source, "justdamaged", "yes" ) local damagereset = setTimer ( resethurt, 20000, 1, source ) if ( getElementType( attacker ) == "player" ) then local wlevel = getPlayerWantedLevel( attacker ) if wlevel < 1 then setPlayerWantedLevel( attacker, wlevel+1 ) end elseif ( getElementType( attacker ) == "vehicle" ) then local thekiller = getVehicleController( attacker ) if isElement(thekiller) then local wlevel = getPlayerWantedLevel ( thekiller ) if wlevel < 1 then setPlayerWantedLevel( thekiller, wlevel+1 ) end end end end end end end addEventHandler ( "onPlayerDamage", getRootElement(), assaultinganofficer ) function resethurt(source) if isElement(source) then setElementData ( source, "justdamaged", "none" ) end end --WANTED LEVEL IF SOMEONE OTHER THAN A COP JACKS SOMEONE function carjackcheck(theVehicle, seat, jacker) if isElement(jacker) then if getElementParent(jacker) == kingCOP then return end local wlevel = getPlayerWantedLevel( jacker ) if wlevel < 4 then setPlayerWantedLevel( jacker, wlevel+1 ) end end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), carjackcheck ) --WANTED LEVEL IF NON-COP TRIES TO USE A COP CAR function copcarcheck(theVehicle, seat, jacked) if getElementParent(source) == kingCOP then return else local carid = getElementModel( theVehicle ) if carid == 598 or carid == 596 or carid == 597 or carid == 427 or carid == 490 or carid == 599 then if (getElementData ( source, "currentstatus" ) ~= "underarrest" ) then local wlevel = getPlayerWantedLevel( source ) if wlevel < 4 then setPlayerWantedLevel( source, wlevel+1 ) end end end end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), copcarcheck ) -- WANTED LEVEL IF A COP SEES SOMEONE DOING SOMETHING ILLEGAL -- TO MAKE THIS WORK WITH YOUR SCRIPT, SET A PLAYERS ELEMENT DATA "legalstatus" TO "illegal" WHILE DOING SOMETHING ILLEGAL -- DONT FORGET TO CHANGE IT TO SOMETHING ELSE AFTERWARDS THOUGH!! function inspection ( element ) if isElement(element) then if ( getElementType ( element ) == "player" ) then if getElementParent(source) == kingCOP then local wlevel = getPlayerWantedLevel( source ) if wlevel == 0 then if (getElementData ( element, "legalstatus" ) == "illegal" ) then local cx, cy, cz = getElementPosition ( source ) local px, py, pz = getElementPosition ( element ) if ( getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) < 15 ) then setPlayerWantedLevel ( element, 1 ) end end end end end end end addEventHandler ( "onPlayerTarget", getRootElement(), inspection ) --STUFF TO MAKE BRIBE PICKUPS WORK function pickedUpWantedCheck ( player ) if ( getElementType(source) == "pickup" ) then if getPickupType ( source ) == 3 then if (getElementData ( source, "model" ) == "1247" ) then local level = getPlayerWantedLevel(player) if ( level > 0 ) then setPlayerWantedLevel ( player, level-1 ) end end end end end addEventHandler ( "onPickupHit", getRootElement(), pickedUpWantedCheck ) addEventHandler("onPlayerJoin", root, function ( ) setPlayerNametagText ( source, getPlayerName ( source ) .."[".. getPlayerWantedLevel ( source ) .."]" ) end ) function updateNametagWantedLevel ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do setPlayerNametagText ( player, getPlayerName ( player ) .."[".. getPlayerWantedLevel ( player ) .."]" ) end end setTimer ( updateNametagWantedLevel,60000, 0 ) local Timer = {} Bribe = {} xMain_ = function( ) for index,v in ipairs (getElementsByType("player")) do xWanted_(v) end end addEventHandler("onResourceStart", resourceRoot, xMain_); xWanted_ = function(v) if not isElement(v) then return end Timer[v] = setTimer( function(player) if isElement(player) then local team = getPlayerTeam(player) if ( team and getTeamName(team) == "Police" ) then return end local Wanted = getPlayerWantedLevel ( player ); local x,y,z = getElementPosition ( player ); local Name = getPlayerName ( player ); if ( Wanted >= 1 ) then if Bribe[player] and isElement(Bribe[player]) then return end Bribe[player] = createObject(1247,x,y,z); attachElements (Bribe[player],player,0,0,1.6) ; outputChatBox(" [ "..Name.." ] Have [ "..Wanted.." ] Wanted Level! ",v,255,0,0,true); elseif ( Wanted == 0 and Bribe[player] and isElement(Bribe[player]) ) then destroyElement(Bribe[player]); Bribe[player] = nil end end end ,5000,0,v); end xJoin_ = function ( ) xWanted_(source); end addEventHandler("onPlayerJoin",root,xJoin_); xWantedDestroy_ = function ( ) if Timer[source] and isTimer(Timer[source]) then killTimer(Timer[source]); Timer[source] = nil end; if Bribe[source] and isElement(Bribe[source]) then destroyElement(Bribe[source]); Bribe[source] = nil end end addEventHandler("onPlayerQuit",root,xWantedDestroy_); Link to comment
Moderators IIYAMA Posted January 8, 2014 Moderators Share Posted January 8, 2014 See line "32" there you can set up the time (5000 ms /5 sec) local wantedLevels = getPlayerWantedLevel ( source) local wantedTime = wantedLevels * 5000 if wantedTime > 50 then -- set the timer or do what you want. end Link to comment
abdalbaset Posted January 8, 2014 Author Share Posted January 8, 2014 like this? local Timer = {} Bribe = {} xMain_ = function( ) for index,v in ipairs (getElementsByType("player")) do xWanted_(v) end end addEventHandler("onResourceStart", resourceRoot, xMain_); xWanted_ = function(v) if not isElement(v) then return end Timer[v] = setTimer( function(player) if isElement(player) then local team = getPlayerTeam(player) if ( team and getTeamName(team) == "Police" ) then return end local Wanted = getPlayerWantedLevel ( player ); local x,y,z = getElementPosition ( player ); local Name = getPlayerName ( player ); if ( Wanted >= 1 ) then if Bribe[player] and isElement(Bribe[player]) then return end Bribe[player] = createObject(1247,x,y,z); attachElements (Bribe[player],player,0,0,1.6) ; outputChatBox(" [ "..Name.." ] Have [ "..Wanted.." ] Wanted Level! ",v,255,0,0,true); elseif ( Wanted == 0 and Bribe[player] and isElement(Bribe[player]) ) then destroyElement(Bribe[player]); Bribe[player] = nil end end end local wantedLevels = getPlayerWantedLevel ( source) local wantedTime = wantedLevels * 5000 if wantedTime > 50 then -- set the timer or do what you want. end end xJoin_ = function ( ) xWanted_(source); end addEventHandler("onPlayerJoin",root,xJoin_); xWantedDestroy_ = function ( ) if Timer[source] and isTimer(Timer[source]) then killTimer(Timer[source]); Timer[source] = nil end; if Bribe[source] and isElement(Bribe[source]) then destroyElement(Bribe[source]); Bribe[source] = nil end end addEventHandler("onPlayerQuit",root,xWantedDestroy_); Link to comment
Moderators IIYAMA Posted January 8, 2014 Moderators Share Posted January 8, 2014 nope. Btw this timer doesn't drop the wantedLevel, where is that part? Link to comment
abdalbaset Posted January 8, 2014 Author Share Posted January 8, 2014 ok can you help me? Link to comment
Moderators IIYAMA Posted January 8, 2014 Moderators Share Posted January 8, 2014 ok can you help me? Of course, it is just adding more time for wanted levels. I only can't find the timer that drops the wanted level. But is this all? Can you show me where you got this? (Then I can take a closer look.) Link to comment
abdalbaset Posted January 9, 2014 Author Share Posted January 9, 2014 you mean the script? its made by pristage Link to comment
Moderators IIYAMA Posted January 9, 2014 Moderators Share Posted January 9, 2014 I don't know that guy. But if you want help, you must make it easier for people to help you, by giving the information they are asking for. Link to comment
abdalbaset Posted January 9, 2014 Author Share Posted January 9, 2014 man can you expline what you talking about? i just fond this scripts in maps and mods Link to comment
Karuzo Posted January 9, 2014 Share Posted January 9, 2014 Just show us the whole script please. Link to comment
abdalbaset Posted January 10, 2014 Author Share Posted January 10, 2014 1 --WANTED LEVEL IF A PLAYER IS MURDERED BY A NON-COP, OR IF AN INNOCENT PERSON IS MURDERED BY A COP function aplayerdied( ammo, attacker, weapon, bodypart ) local glevel = getPlayerWantedLevel ( source ) if isElement(attacker) then local wlevel = getPlayerWantedLevel( source ) if wlevel > 0 then if getElementParent(attacker) == kingCOP then setPlayerWantedLevel( source, 0 ) end end if ( getElementType( attacker ) == "player" ) then local wlevel = getPlayerWantedLevel( attacker ) if wlevel < 6 then setPlayerWantedLevel( attacker, wlevel+1 ) end elseif ( getElementType( attacker ) == "vehicle" ) then thekiller = getVehicleController( attacker ) if isElement(thekiller) then local wlevel = getPlayerWantedLevel ( thekiller ) if wlevel < 6 then setPlayerWantedLevel( thekiller, wlevel+1 ) end end end end setPlayerWantedLevel( source, 0 ) end addEventHandler ( "onPlayerWasted", getRootElement(), aplayerdied ) --WANTED LEVEL IF A POLICE OFFICER IS ATTACKED function assaultinganofficer ( attacker, weapon, bodypart, loss ) if getElementParent(source) == kingCOP then if isElement(attacker) then if ( getElementType( attacker ) == "player" ) then if getElementParent(attacker) == kingCOP then return end elseif ( getElementType( attacker ) == "vehicle" ) then thedriver = getVehicleController( attacker ) if isElement(thedriver) then if getElementParent(thedriver) == kingCOP then return end end end if (getElementData ( source, "justdamaged" ) ~= "yes") and (source ~= attacker) then setElementData ( source, "justdamaged", "yes" ) local damagereset = setTimer ( resethurt, 20000, 1, source ) if ( getElementType( attacker ) == "player" ) then local wlevel = getPlayerWantedLevel( attacker ) if wlevel < 1 then setPlayerWantedLevel( attacker, wlevel+1 ) end elseif ( getElementType( attacker ) == "vehicle" ) then local thekiller = getVehicleController( attacker ) if isElement(thekiller) then local wlevel = getPlayerWantedLevel ( thekiller ) if wlevel < 1 then setPlayerWantedLevel( thekiller, wlevel+1 ) end end end end end end end addEventHandler ( "onPlayerDamage", getRootElement(), assaultinganofficer ) function resethurt(source) if isElement(source) then setElementData ( source, "justdamaged", "none" ) end end --WANTED LEVEL IF SOMEONE OTHER THAN A COP JACKS SOMEONE function carjackcheck(theVehicle, seat, jacker) if isElement(jacker) then if getElementParent(jacker) == kingCOP then return end local wlevel = getPlayerWantedLevel( jacker ) if wlevel < 4 then setPlayerWantedLevel( jacker, wlevel+1 ) end end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), carjackcheck ) --WANTED LEVEL IF NON-COP TRIES TO USE A COP CAR function copcarcheck(theVehicle, seat, jacked) if getElementParent(source) == kingCOP then return else local carid = getElementModel( theVehicle ) if carid == 598 or carid == 596 or carid == 597 or carid == 427 or carid == 490 or carid == 599 then if (getElementData ( source, "currentstatus" ) ~= "underarrest" ) then local wlevel = getPlayerWantedLevel( source ) if wlevel < 4 then setPlayerWantedLevel( source, wlevel+1 ) end end end end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), copcarcheck ) -- WANTED LEVEL IF A COP SEES SOMEONE DOING SOMETHING ILLEGAL -- TO MAKE THIS WORK WITH YOUR SCRIPT, SET A PLAYERS ELEMENT DATA "legalstatus" TO "illegal" WHILE DOING SOMETHING ILLEGAL -- DONT FORGET TO CHANGE IT TO SOMETHING ELSE AFTERWARDS THOUGH!! function inspection ( element ) if isElement(element) then if ( getElementType ( element ) == "player" ) then if getElementParent(source) == kingCOP then local wlevel = getPlayerWantedLevel( source ) if wlevel == 0 then if (getElementData ( element, "legalstatus" ) == "illegal" ) then local cx, cy, cz = getElementPosition ( source ) local px, py, pz = getElementPosition ( element ) if ( getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) < 15 ) then setPlayerWantedLevel ( element, 1 ) end end end end end end end addEventHandler ( "onPlayerTarget", getRootElement(), inspection ) --STUFF TO MAKE BRIBE PICKUPS WORK function pickedUpWantedCheck ( player ) if ( getElementType(source) == "pickup" ) then if getPickupType ( source ) == 3 then if (getElementData ( source, "model" ) == "1247" ) then local level = getPlayerWantedLevel(player) if ( level > 0 ) then setPlayerWantedLevel ( player, level-1 ) end end end end end addEventHandler ( "onPickupHit", getRootElement(), pickedUpWantedCheck ) addEventHandler("onPlayerJoin", root, function ( ) setPlayerNametagText ( source, getPlayerName ( source ) .."[".. getPlayerWantedLevel ( source ) .."]" ) end ) function updateNametagWantedLevel ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do setPlayerNametagText ( player, getPlayerName ( player ) .."[".. getPlayerWantedLevel ( player ) .."]" ) end end setTimer ( updateNametagWantedLevel,60000, 0 ) 2 ------------------- -- Wanted System -- Mr.Pres[T]ege -- (; ------------------- local Timer = {} Bribe = {} xMain_ = function( ) for index,v in ipairs (getElementsByType("player")) do xWanted_(v) end end addEventHandler("onResourceStart", resourceRoot, xMain_); xWanted_ = function(v) if not isElement(v) then return end Timer[v] = setTimer( function(player) if isElement(player) then local team = getPlayerTeam(player) if ( team and getTeamName(team) == "Police" ) then return end local Wanted = getPlayerWantedLevel ( player ); local x,y,z = getElementPosition ( player ); local Name = getPlayerName ( player ); if ( Wanted >= 1 ) then if Bribe[player] and isElement(Bribe[player]) then return end Bribe[player] = createObject(1247,x,y,z); attachElements (Bribe[player],player,0,0,1.6) ; outputChatBox(" [ "..Name.." ] Have [ "..Wanted.." ] Wanted Level! ",v,255,0,0,true); elseif ( Wanted == 0 and Bribe[player] and isElement(Bribe[player]) ) then destroyElement(Bribe[player]); Bribe[player] = nil end end end local wantedLevels = getPlayerWantedLevel ( player) local wantedTime = wantedLevels * 5000 if wantedTime > 50 then -- set the timer or do what you want. end end xJoin_ = function ( ) xWanted_(source); end addEventHandler("onPlayerJoin",root,xJoin_); xWantedDestroy_ = function ( ) if Timer[source] and isTimer(Timer[source]) then killTimer(Timer[source]); Timer[source] = nil end; if Bribe[source] and isElement(Bribe[source]) then destroyElement(Bribe[source]); Bribe[source] = nil end end addEventHandler("onPlayerQuit",root,xWantedDestroy_); this isit Link to comment
Moderators IIYAMA Posted January 10, 2014 Moderators Share Posted January 10, 2014 It is incomplete. There are no setPlayerWantedLevel functions in the second part, your levels aren't dropping with time. Except by killing your self >part1. Link to comment
abdalbaset Posted January 10, 2014 Author Share Posted January 10, 2014 Man I am biggener in this so you can tell me what to do with detail s Link to comment
.:HyPeX:. Posted January 10, 2014 Share Posted January 10, 2014 Man I am biggener in this so you can tell me what to do with detail s You just copied over the script from another resource, before trying to edit it, learn some scripting.. And by the way, you have the script's owner's approval to use it? Link to comment
abdalbaset Posted January 10, 2014 Author Share Posted January 10, 2014 As I said its not may script I fond it in maps and mods what the worong Link to comment
.:HyPeX:. Posted January 10, 2014 Share Posted January 10, 2014 As I said its not may script I fond it in maps and mods what the worong That you should ask the owner of the script first. Link to comment
abdalbaset Posted January 10, 2014 Author Share Posted January 10, 2014 Asking him about what editing the script or to help me BTW there many people work in this script so I have so ask them all Link to comment
.:HyPeX:. Posted January 10, 2014 Share Posted January 10, 2014 Asking him about what editing the script or to help me BTW there many people work in this script so I have so ask them all oh god.. to ask the "CREATOR" of the original script if he allows you to modify his work! 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