Adde Posted September 15, 2013 Posted September 15, 2013 Hey, I got my jail system here and everything works without "triggerServerEvent("freefromthejail", source). Anyone can help me? If I change source to root, the whole server is being fucked. server error, markers everywere, guis being opened, etc. client: x, y = guiGetScreenSize() function startMission() MissionTimer1 = exports.missiontimer:createMissionTimer ( 10000, true, "%m:%s" , 0.8/2*x, 0.8/2*y, true, "default-bold", 5, 255, 10, 10 ) addEventHandler ( "onClientMissionTimerElapsed", getRootElement(), freeFromJail) end addEvent("setMissionTimer", true) addEventHandler("setMissionTimer", getLocalPlayer(), startMission) function freeFromJail() if MissionTimer1 then destroyElement(MissionTimer1) outputChatBox(getLocalPlayer(source).. "has been released from jail", getLocalPlayer(), 0, 240, 0) triggerServerEvent("freefromthejail", source) end end server: kreward = 150 function policeJob ( attacker, attackerweapon, bodypart, loss ) if attacker and getElementType(attacker) == "player" then theTeam = getPlayerTeam ( attacker ) local wlevel = getPlayerWantedLevel( source ) theSkin = getElementModel ( attacker ) if (attackerweapon == 3) and (loss > 2 ) and (wlevel > 0) then if getTeamName( theTeam ) == "Police Department" or getTeamName( theTeam ) == "Staff" or getTeamName( theTeam ) == "US Army" or getTeamName( theTeam ) == "US Marines" then setElementPosition ( source, 264.74, 77.69, 1001.03 ) setElementInterior ( source, 6 ) setElementDimension ( source, 3 ) toggleControl(source, "fire", false) toggleControl(source, "next_weapon", false) toggleControl(source, "previous_weapon", false) toggleControl(source, "aim_weapon", false) toggleControl(source, "vehicle_fire", false) theName = getPlayerName ( source ) theCop = getPlayerName ( attacker ) outputChatBox ( "You have been jailed by "..theCop.. " for 5 minutes.", source ) outputChatBox ( "You have jailed "..theName, attacker ) local thisreward = wlevel*kreward givePlayerMoney ( attacker, thisreward ) setPlayerWantedLevel ( source, 0) triggerClientEvent("setMissionTimer", source) end end end end addEventHandler ("onPlayerDamage", getRootElement(), policeJob) function freeJail() setElementPosition ( source, 1541.66, -1353.80, 329.5 ) setElementInterior ( source, 0 ) setElementDimension ( source, 0 ) toggleControl(source, "fire", true) toggleControl(source, "next_weapon", true) toggleControl(source, "previous_weapon", true) toggleControl(source, "aim_weapon", true) toggleControl(source, "vehicle_fire", true) end addEvent("freefromthejail", true) addEventHandler("freefromthejail", getRootElement(), freeJail) My ingame nickname is: Mr.Snus
Castillo Posted September 15, 2013 Posted September 15, 2013 Change "source" at triggerServerEvent to "localPlayer". San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Adde Posted September 15, 2013 Author Posted September 15, 2013 Ye that´s it! Why didn´t I test that before, hah. but thx My ingame nickname is: Mr.Snus
Castillo Posted September 15, 2013 Posted September 15, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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