Zelev Posted December 24, 2018 Share Posted December 24, 2018 Hi! I'm a kind of noob scripter making a VIP panel, but I do not find a way to set.. for example, I want the player to spawn op weapons (only for vip users in this case), like Rocket Launcher, only a few times at day, not more than the established number of times for spawning it. Is it possible to do that? Also spawn Rhino's and some vehicles that I made only for VIP's. Link to comment
Storm-Hanma Posted December 25, 2018 Share Posted December 25, 2018 (edited) you can do it by using team function or acl function for vips ,then for weapons or vehicle like rhino,minguns etc.. use set timer make sure you know basics of timing for example look up for this code below i made this hydra veh for my shop system were player can buy hydra for money and use it for only 5 min ! you can do same with weapon also by using give weapon function & set timer ! visit here you can get all ideas from here https://wiki.multitheftauto.com/wiki/Main_Page addEvent ("Hydra - 2m$ for 5 min",true) addEventHandler ("Hydra - 2m$ for 5 min",root, function ( ) if getPlayerMoney ( source ) > 2000000 then takePlayerMoney (source, 2000000) setElementHealth (source,200) local x,y,z = getElementPosition (source) --The source is the player that triggered the event local vehicle = createVehicle (520,x+3,y+3,z+1) -- I'll just spawn a hydra or whatever local minutes = 5 local milisec = minutes * 60000 --Just passing minutes to miliseconds. setTimer (function() destroyElement (vehicle) outputChatBox ("[Server]: 5 min is up buy again and have fun" ,source,0,255,255,true) end,milisec,1) else outputChatBox ("[Server]: You dont have enough money to spawn hydra !" ,source,0,255,0,true) end end ) Edited December 25, 2018 by KINGKHAN 1 Link to comment
keymetaphore Posted December 25, 2018 Share Posted December 25, 2018 4 hours ago, KINGKHAN said: you can do it by using team function or acl function for vips ,then for weapons or vehicle like rhino,minguns etc.. use set timer make sure you know basics of timing for example look up for this code below i made this hydra veh for my shop system were player can buy hydra for money and use it for only 5 min ! you can do same with weapon also by using give weapon function & set timer ! visit here you can get all ideas from here https://wiki.multitheftauto.com/wiki/Main_Page addEvent ("Hydra - 2m$ for 5 min",true) addEventHandler ("Hydra - 2m$ for 5 min",root, function ( ) if getPlayerMoney ( source ) > 2000000 then takePlayerMoney (source, 2000000) setElementHealth (source,200) local x,y,z = getElementPosition (source) --The source is the player that triggered the event local vehicle = createVehicle (520,x+3,y+3,z+1) -- I'll just spawn a hydra or whatever local minutes = 5 local milisec = minutes * 60000 --Just passing minutes to miliseconds. setTimer (function() destroyElement (vehicle) outputChatBox ("[Server]: 5 min is up buy again and have fun" ,source,0,255,255,true) end,milisec,1) else outputChatBox ("[Server]: You dont have enough money to spawn hydra !" ,source,0,255,0,true) end end ) Please view the article formatting code and indent your code properly, I don't think this belongs in scripting support section. Link to comment
Storm-Hanma Posted December 25, 2018 Share Posted December 25, 2018 3 hours ago, keymetaphore said: Please view the article formatting code and indent your code properly, I don't think this belongs in scripting support section. wait what ? not belongs to script section? Link to comment
keymetaphore Posted December 25, 2018 Share Posted December 25, 2018 3 hours ago, KINGKHAN said: wait what ? not belongs to script section? With the code you supplied you are showing a bad example. If you have further questions bring this up in PMs. Link to comment
Storm-Hanma Posted December 25, 2018 Share Posted December 25, 2018 I don't think I provided bad example I just showed him how to I don't need to pm you simple .. 1 Link to comment
Zelev Posted December 26, 2018 Author Share Posted December 26, 2018 On 25/12/2018 at 01:31, KINGKHAN said: you can do it by using team function or acl function for vips ,then for weapons or vehicle like rhino,minguns etc.. use set timer make sure you know basics of timing for example look up for this code below i made this hydra veh for my shop system were player can buy hydra for money and use it for only 5 min ! you can do same with weapon also by using give weapon function & set timer ! visit here you can get all ideas from here https://wiki.multitheftauto.com/wiki/Main_Page addEvent ("Hydra - 2m$ for 5 min",true) addEventHandler ("Hydra - 2m$ for 5 min",root, function ( ) if getPlayerMoney ( source ) > 2000000 then takePlayerMoney (source, 2000000) setElementHealth (source,200) local x,y,z = getElementPosition (source) --The source is the player that triggered the event local vehicle = createVehicle (520,x+3,y+3,z+1) -- I'll just spawn a hydra or whatever local minutes = 5 local milisec = minutes * 60000 --Just passing minutes to miliseconds. setTimer (function() destroyElement (vehicle) outputChatBox ("[Server]: 5 min is up buy again and have fun" ,source,0,255,255,true) end,milisec,1) else outputChatBox ("[Server]: You dont have enough money to spawn hydra !" ,source,0,255,0,true) end end ) The script does not work... Maybe if you paste the script orderly I could understand better. Have you tested it recently btw? 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