TrapLord Studios™ Posted July 22, 2012 Share Posted July 22, 2012 Good Day every one, i am having a problem with the /makeveh cmd in the shodown roleplay script, when i use it i see the syntax but when i do it correctly it doesnt work. I am also having a problem with the interior, when i make an interior it says the "Government Cant Afford". I would Like If you help me please Link to comment
Tete omar Posted July 22, 2012 Share Posted July 22, 2012 and it's so simple do like this function anything( player, commandName ) if not isPedInVehicle ( player ) then -- checks if the player is already in a vehicle local color = {} -- table of random colors color[1] = math.random(1,126) -- color 1 color[2] = math.random(0,126) -- color 2 color[3] = math.random(0,126) -- color 3 color[4] = math.random(0,126) -- color 4 sX, sY, sZ = getElementPosition ( player ) -- gets the player's position blade = createVehicle ( 536, sX, sY, sZ ) -- create a vehicle "536" you can change it whatever you like warpPedIntoVehicle ( player, blade ) -- warp him into the car setVehicleColor ( blade, color[1], color[2], color[3], color[4] ) -- sets the vehicle random colors outputChatBox("Blade has been spawned",getRootElement(),255,255,0, true) -- outPutChatBox that blade has been spawned setVehicleDamageProof ( blade, true ) -- sets the car infinity health else outputChatBox("you can not spawn a vehicle when you already in one sorry",getRootElement(),255,0,0, true) end end end addCommandHandler ( "spawnblade", anything )-- add the command handler which the player will type i added some new stuff here like infinity vehicle health Link to comment
Anderl Posted July 22, 2012 Share Posted July 22, 2012 @@teteomar, make variables local. Link to comment
AeroXbird Posted July 22, 2012 Share Posted July 22, 2012 Try this: function anything( player, commandName ) if not isPedInVehicle ( player ) then -- checks if the player is already in a vehicle local color = {} -- table of random colors local color[1] = math.random(1,126) -- color 1 local color[2] = math.random(0,126) -- color 2 local color[3] = math.random(0,126) -- color 3 local color[4] = math.random(0,126) -- color 4 local sX, sY, sZ = getElementPosition ( player ) -- gets the player's position local blade = createVehicle ( 536, sX, sY, sZ ) -- create a vehicle "536" you can change it whatever you like warpPedIntoVehicle ( player, blade ) -- warp him into the car setVehicleColor ( blade, color[1], color[2], color[3], color[4] ) -- sets the vehicle random colors outputChatBox("Blade has been spawned",player,255,255,0, true) -- outPutChatBox that blade has been spawned setVehicleDamageProof ( blade, true ) -- sets the car infinity health else outputChatBox("You can not spawn a vehicle when you already in one",player,255,0,0, true) end end addCommandHandler ( "spawnblade", anything )-- add the command handler which the player will type you had one end too much, and using local variables is usually the best way to go. Link to comment
Tete omar Posted July 22, 2012 Share Posted July 22, 2012 thanks AeroXbird i got that 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