Is there a command in pawno to "do nothing"
#1

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.
Reply
#2

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

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); }
}
Reply
#4

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
Reply
#5

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

Thanks. could be useful in a bunch of different areas
Reply
#7

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);
}
Reply
#8

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"
Reply
#9

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)
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)