SA-MP Forums Archive
Is there a command in pawno to "do nothing" - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Is there a command in pawno to "do nothing" (/showthread.php?tid=90607)



Is there a command in pawno to "do nothing" - ThePS3Guy - 09.08.2009

For example,I am trying to add nos to vehicles (trying to learn on my own, not use someones pre-made filter scripts thanks anyways though), so I am trying to do this:

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if vehicleid=(blah blah all the ids that can't have nos);
do nothing;
else AddVehicleComponent(vehicle, 1010);
}

So is there a way to tell the script not to do anything in that case? Thanks.


Re: Is there a command in pawno to "do nothing" - SampStunta - 09.08.2009

You can also add pickup nos off MTA RACE map editor xD


Re: Is there a command in pawno to "do nothing" - Zeromanster - 09.08.2009

You can just do this:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
   if vehicleid = (Car ID's that can't have NOS); { }
   else { AddVehicleComponent(vehicle, 1010); }
}



Re: Is there a command in pawno to "do nothing" - ThePS3Guy - 09.08.2009

so let me get this straight.. just to help me learn

just saying if ... without telling pawno to do anything if that is the case is the same as telling it to do nothing?

Thanks btw


Re: Is there a command in pawno to "do nothing" - Zeromanster - 09.08.2009

Thats how I've been doing it, it worked me, so it should work for you.


Re: Is there a command in pawno to "do nothing" - ThePS3Guy - 09.08.2009

Thanks. could be useful in a bunch of different areas


Re: Is there a command in pawno to "do nothing" - ev0lution - 09.08.2009

Or just reverse the "if", and forget about using "else".
Example:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
   if(vehicleid != (Car ID's that can't have NOS)) AddVehicleComponent(vehicleid, 1010);
}



Re: Is there a command in pawno to "do nothing" - ThePS3Guy - 09.08.2009

if(vehicleid != (Car ID's that can't have NOS)) AddVehicleComponent(vehicleid, 1010);

I'm guessing that the ! in that equation means "does not equal"


Re: Is there a command in pawno to "do nothing" - ev0lution - 09.08.2009

Quote:
Originally Posted by ThePS3Guy
if(vehicleid != (Car ID's that can't have NOS)) AddVehicleComponent(vehicleid, 1010);

I'm guessing that the ! in that equation means "does not equal"
Yes.
== is equal to,
!= is not equal to.
Also, you don't need { and } around it if you've got a 1-line "if" statement. (As shown in my code)


Re: Is there a command in pawno to "do nothing" - ThePS3Guy - 09.08.2009

Thanks evolution, that helps a lot. I have one more question though. I am trying to create my own script that deletes a car after u exit it. I am planning on using OnPlayerStateChange, but I don't know what the command is. I mean, what do you call someone that isn't in a vehicle (dont know how better to explain it). I would think it's something like this: "if playerisnotinvehicle(<--thats what i dont know)(DestroyVehicle(vehicleid);"

i hope u know what i mean