SA-MP Forums Archive
If the 4th integer is true.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: If the 4th integer is true.. (/showthread.php?tid=652167)



If the 4th integer is true.. - Drak03 - 04.04.2018


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


Re: If the 4th integer is true.. - Jstylezzz - 04.04.2018

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


Re: If the 4th integer is true.. - Drak03 - 04.04.2018

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


Re: If the 4th integer is true.. - Drak03 - 04.04.2018

new model, siren, color1, color2;


Re: If the 4th integer is true.. - Jstylezzz - 04.04.2018

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.


Re: If the 4th integer is true.. - Drak03 - 04.04.2018

Here you go.

Im still a beginner so sorry.


Re: If the 4th integer is true.. - AdamsLT - 04.04.2018

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.


Re: If the 4th integer is true.. - Drak03 - 04.04.2018

How could i check if its 1 or 0?

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


Re: If the 4th integer is true.. - AdamsLT - 04.04.2018

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



Re: If the 4th integer is true.. - Drak03 - 04.04.2018

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