Jump to content

[HELP] How to set weapon spawn time


Zelev

Recommended Posts

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

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 by KINGKHAN
  • Like 1
Link to comment
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
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
  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...