If the 4th integer is true..
#1


How can i make it so when the 4th integer, siren is 1, it will add a siren?
Reply
#2

4th integer of what?
Do you have an array of variables from which to read?
Reply
#3

If i do /createveh 411 0 0 1, i want the vehicle to spawn with a siren. How could i do that?
Reply
#4

new model, siren, color1, color2;
Reply
#5

Do you have a /createveh command already? If so, please post what you have so far. Then I'll be able to give you specific advice.
Reply
#6

Here you go.

Im still a beginner so sorry.
Reply
#7

Just check if the variable siren is 1 or 0 (return an error message if not).

Then pass the variable to CreateVehicle at the end like in the wiki.

https://sampwiki.blast.hk/wiki/CreateVehicle
example:
CreateVehicle(model, x, y, z, rotation, color1, color2, respawn_time, siren);

Edit: you provided the code as I posted, so I can see that you forgot to add respawn_time in the middle. Instead of respawn_time you can use -1 (like it says in the wiki) and it will never respawn and then pass siren, it should work.

I advise saving rotation data along with coordinates for the car so that it doesn't spawn unpredictably.
Reply
#8

How could i check if its 1 or 0?

if(siren)?
I guess that wouldnt fit in this command?
Reply
#9

Quote:
Originally Posted by Drak03
View Post
How could i check if its 1 or 0?

if(siren)?
I guess that wouldnt fit in this command?
I don't remember how sscanf handles boolean values so I'd suggest using a regular int to store the siren value.
Checking if(siren) would not pass if the siren is set to 0.

PHP Code:
if (siren != && siren != 1) return error_message
Reply
#10

Oh yeah, i forgot that. Thanks both for your effort! +rep both of you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)