3B00DG4MER Posted March 20, 2014 Share Posted March 20, 2014 Hello,Today i made script which on Hit it -1 Wanted Level But,When i hit it nothing happend Client side : function bribe () createPickup ( 2507.1298828125, -1701.2734375, 14.508857727051, 3, 1247, 25000, 1) end addEventHandler ( "onResourceStart", getRootElement(), bribe ) 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 ) Link to comment
Anubhav Posted March 20, 2014 Share Posted March 20, 2014 function bribe () local bribe = createPickup ( 2507.1298828125, -1701.2734375, 14.508857727051, 3, 1247, 25000, 1) end addEventHandler ( "onResourceStart", getRootElement(), bribe ) function pickedUpWantedCheck ( thePlayer ) local level = getPlayerWantedLevel(thePlayer) if ( level > 0 ) then setPlayerWantedLevel ( thePlayer, level-1 ) end end addEventHandler ( "onPickupHit", bribe, pickedUpWantedCheck ) Link to comment
Saml1er Posted March 20, 2014 Share Posted March 20, 2014 This is server side script and you're running it in client side? That won't work. Modify its type as server side script in your meta.xml. Link to comment
cheez3d Posted March 20, 2014 Share Posted March 20, 2014 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) Link to comment
3B00DG4MER Posted March 20, 2014 Author Share Posted March 20, 2014 function bribe () local bribe = createPickup ( 2507.1298828125, -1701.2734375, 14.508857727051, 3, 1247, 25000, 1) end addEventHandler ( "onResourceStart", getRootElement(), bribe ) function pickedUpWantedCheck ( thePlayer ) local level = getPlayerWantedLevel(thePlayer) if ( level > 0 ) then setPlayerWantedLevel ( thePlayer, level-1 ) end end addEventHandler ( "onPickupHit", bribe, pickedUpWantedCheck ) Thanks Link to comment
Anubhav Posted March 20, 2014 Share Posted March 20, 2014 No problem. If you ever need help you can add me on skype even anubhav.agarwal87 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