TheIceman1 Posted February 26, 2013 Posted February 26, 2013 Why this dont respawn me at position(source, 1546.51, -1675.71, 13.5 ,and why i dont get arrest? function wanted1( attacker, attackerweapon ) money = math.random ( 100, 500 ) time = math.random ( 5000, 15000 ) theSkin = getElementModel( attacker ) WL = getPlayerWantedLevel( source ) if (attackerweapon == 3) and ( theSkin == 280 ) and (getPlayerWantedLevel( source ) == 1 ) and ( WL > 0 )) then exports ["guimessages"] : outputServer ( source, "You are jailed by "..getPlayerName(attacker).."." , 25, 25, 255) exports ["guimessages"] : outputServer ( attacker, "You have arrest "..getPlayerName(source).."." , 25, 25, 255) givePlayerMoney ( attacker, money ) playeraccount = getPlayerAccount( attacker ) arrestnumber = getAccountData( playeraccount, "Arrests" ) setAccountData ( playeraccount, "Arrests", tonumber(arrestnumber)+1) setElementPosition ( source, 0, 0, 0 ) toggleAllControls ( source, false ) setTimer ( toggleAllControls, time, 1, source, true ) setTimer ( setElementPosition, time, 1, source, 1546.51, -1675.71, 13.5 ) setTimer ( setPlayerWantedLevel, time, 1, source, 0 ) end end addEventHandler ("onPlayerDamage", getRootElement(), wanted1)
Castillo Posted February 26, 2013 Posted February 26, 2013 function wanted1 ( attacker, attackerweapon ) local money = math.random ( 100, 500 ) local time = math.random ( 5000, 15000 ) local theSkin = getElementModel ( attacker ) local WL = getPlayerWantedLevel ( source ) if ( attackerweapon == 3 ) and ( theSkin == 280 ) and ( WL > 0 ) then exports [ "guimessages" ] : outputServer ( source, "You are jailed by ".. getPlayerName ( attacker ) .."." , 25, 25, 255 ) exports [ "guimessages" ] : outputServer ( attacker, "You have arrest ".. getPlayerName ( source ) .."." , 25, 25, 255 ) givePlayerMoney ( attacker, money ) local playeraccount = getPlayerAccount ( attacker ) local arrestnumber = tonumber ( getAccountData ( playeraccount, "Arrests" ) ) or 0 setAccountData ( playeraccount, "Arrests", arrestnumber + 1 ) setElementPosition ( source, 0, 0, 0 ) toggleAllControls ( source, false ) setTimer ( function ( thePlayer ) if ( isElement ( thePlayer ) ) then toggleAllControls ( thePlayer, true ) setElementPosition ( thePlayer, 1546.51, -1675.71, 13.5 ) setPlayerWantedLevel ( thePlayer, 0 ) end end ,time, 1, source ) end end addEventHandler ( "onPlayerDamage", getRootElement(), wanted1 ) Try it.
TheIceman1 Posted February 26, 2013 Author Posted February 26, 2013 function wanted1 ( attacker, attackerweapon ) local money = math.random ( 100, 500 ) local time = math.random ( 5000, 15000 ) local theSkin = getElementModel ( attacker ) local WL = getPlayerWantedLevel ( source ) if ( attackerweapon == 3 ) and ( theSkin == 280 ) and ( WL > 0 ) then exports [ "guimessages" ] : outputServer ( source, "You are jailed by ".. getPlayerName ( attacker ) .."." , 25, 25, 255 ) exports [ "guimessages" ] : outputServer ( attacker, "You have arrest ".. getPlayerName ( source ) .."." , 25, 25, 255 ) givePlayerMoney ( attacker, money ) local playeraccount = getPlayerAccount ( attacker ) local arrestnumber = tonumber ( getAccountData ( playeraccount, "Arrests" ) ) or 0 setAccountData ( playeraccount, "Arrests", arrestnumber + 1 ) setElementPosition ( source, 0, 0, 0 ) toggleAllControls ( source, false ) setTimer ( function ( thePlayer ) if ( isElement ( thePlayer ) ) then toggleAllControls ( thePlayer, true ) setElementPosition ( thePlayer, 1546.51, -1675.71, 13.5 ) setPlayerWantedLevel ( thePlayer, 0 ) end end ,time, 1, source ) end end addEventHandler ( "onPlayerDamage", getRootElement(), wanted1 ) Try it. Working,but i didnt get arrests.Maybe is problem here? addEventHandler("onPlayeDamage",root, function (attacker, weapon) local weap = getWeaponNameFromID(3) local skin = getElementModel ( attacker ) local team = getTeamFromName( getPlayerTeam ( attacker ) ) local wl = getPlayerWantedLevel ( source ) if (skin == 280 ) and ( team == "Police" ) and ( wl > 0 ) and ( weap == 3 ) then addPlayerArrests(attacker) end end) function addPlayerArrests(attacker) local account = getPlayerAccount(attacker) if isGuestAccount(account) then return end local arrests = getAccountData(account,"Arrests") if not arrests then setAccountData(account,"Arrests",0) end setAccountData(account,"Arrests",tonumber(arrests)+1) setElementData(attacker,"Arrests",tonumber(arrests)+1) end addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) if isGuestAccount(account) then return end local arrests = getAccountData(account,"Arrests") if arrests then setElementData(source,"Arrests",tostring(arrests)) else setElementData(source,"Arrests",0) end end)
Castillo Posted February 26, 2013 Posted February 26, 2013 Make it all in one. function wanted1 ( attacker, attackerweapon ) local money = math.random ( 100, 500 ) local time = math.random ( 5000, 15000 ) local theSkin = getElementModel ( attacker ) local WL = getPlayerWantedLevel ( source ) if ( attackerweapon == 3 ) and ( theSkin == 280 ) and ( WL > 0 ) then exports [ "guimessages" ] : outputServer ( source, "You are jailed by ".. getPlayerName ( attacker ) .."." , 25, 25, 255 ) exports [ "guimessages" ] : outputServer ( attacker, "You have arrest ".. getPlayerName ( source ) .."." , 25, 25, 255 ) givePlayerMoney ( attacker, money ) addPlayerArrests ( attacker ) setElementPosition ( source, 0, 0, 0 ) toggleAllControls ( source, false ) setTimer ( function ( thePlayer ) if ( isElement ( thePlayer ) ) then toggleAllControls ( thePlayer, true ) setElementPosition ( thePlayer, 1546.51, -1675.71, 13.5 ) setPlayerWantedLevel ( thePlayer, 0 ) end end ,time, 1, source ) end end addEventHandler ( "onPlayerDamage", getRootElement(), wanted1 ) function addPlayerArrests ( attacker ) local account = getPlayerAccount ( attacker ) if isGuestAccount ( account ) then return end local arrests = getAccountData ( account, "Arrests" ) if ( not arrests ) then setAccountData ( account, "Arrests", 0 ) end setAccountData ( account, "Arrests", tonumber ( arrests ) + 1 ) setElementData ( attacker, "Arrests", tonumber ( arrests ) + 1 ) end addEventHandler ( "onPlayerLogin", root, function ( ) local account = getPlayerAccount ( source ) if isGuestAccount ( account ) then return end local arrests = getAccountData ( account, "Arrests" ) or 0 setElementData ( source, "Arrests", arrests ) end )
TheIceman1 Posted February 26, 2013 Author Posted February 26, 2013 Make it all in one. function wanted1 ( attacker, attackerweapon ) local money = math.random ( 100, 500 ) local time = math.random ( 5000, 15000 ) local theSkin = getElementModel ( attacker ) local WL = getPlayerWantedLevel ( source ) if ( attackerweapon == 3 ) and ( theSkin == 280 ) and ( WL > 0 ) then exports [ "guimessages" ] : outputServer ( source, "You are jailed by ".. getPlayerName ( attacker ) .."." , 25, 25, 255 ) exports [ "guimessages" ] : outputServer ( attacker, "You have arrest ".. getPlayerName ( source ) .."." , 25, 25, 255 ) givePlayerMoney ( attacker, money ) addPlayerArrests ( attacker ) setElementPosition ( source, 0, 0, 0 ) toggleAllControls ( source, false ) setTimer ( function ( thePlayer ) if ( isElement ( thePlayer ) ) then toggleAllControls ( thePlayer, true ) setElementPosition ( thePlayer, 1546.51, -1675.71, 13.5 ) setPlayerWantedLevel ( thePlayer, 0 ) end end ,time, 1, source ) end end addEventHandler ( "onPlayerDamage", getRootElement(), wanted1 ) function addPlayerArrests ( attacker ) local account = getPlayerAccount ( attacker ) if isGuestAccount ( account ) then return end local arrests = getAccountData ( account, "Arrests" ) if ( not arrests ) then setAccountData ( account, "Arrests", 0 ) end setAccountData ( account, "Arrests", tonumber ( arrests ) + 1 ) setElementData ( attacker, "Arrests", tonumber ( arrests ) + 1 ) end addEventHandler ( "onPlayerLogin", root, function ( ) local account = getPlayerAccount ( source ) if isGuestAccount ( account ) then return end local arrests = getAccountData ( account, "Arrests" ) or 0 setElementData ( source, "Arrests", arrests ) end ) Working,thanks!
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