[Help]Problem with OnPlayerStateChange
#1

I wanna be able to get the players old state like this:

pawn Код:
if(GetPlayerOldState(playerid) == PLAYER_STATE_DRIVER)
How to do this?
Reply
#2

Код:
if(oldstate == PLAYER_STATE_DRIVER)
Reply
#3

Quote:
Originally Posted by Martin_M
Код:
if(oldstate == PLAYER_STATE_DRIVER)
would i need a switch?

pawn Код:
switch(oldstate)
?

Also, plz help me with this:

http://forum.sa-mp.com/index.php?topic=138703.0
Reply
#4

What do you want to do exactly?
Here you a little example:
Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(oldstate == PLAYER_STATE_DRIVER) // If i changed my state, and changed from driver to something else
{ // Then..
// Something happens
}
return 1; // OnPlayerStateChange callback return
} // Closing OnPlayerStateChange callback.
Reply
#5

Sorry for double post. Mistake.
Reply
#6

I just wanted to check if I would need a switch. I wanna send a msg to evryone if they exit the car.
Reply
#7

No you don't need a switch statement.
Switch statements are only useful if you want to check for if var is equal to more than one value

Example
pawn Код:
switch(oldstate)
{
  case PLAYER_STATE_DRIVER: { /*something*/ }
  case PLAYER_STATE_PASSENGER: { /*something else*/ }
}
If you only want to check for one state, then a switch statement isn't necesarry.
Reply
#8

Quote:
Originally Posted by lrZ^ aka LarzI
No you don't need a switch statement.
Switch statements are only useful if you want to check for if var is equal to more than one value

Example
pawn Код:
switch(oldstate)
{
  case PLAYER_STATE_DRIVER: { /*something*/ }
  case PLAYER_STATE_PASSENGER: { /*something else*/ }
}
If you only want to check for one state, then a switch statement isn't necesarry.
K, thnx!
Reply
#9

No problem
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)