SA-MP Forums Archive
How would I do this?(If get player state) - 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: How would I do this?(If get player state) (/showthread.php?tid=377054)



How would I do this?(If get player state) - UnknownGamer - 12.09.2012

pawn Код:
if(GetPlayerState(playerid) == !PLAYER_STATE_DRIVER))
You get errors of target mismatch?

How do I fix this?

To do, If player is not in a vehicle, Sendclientmessage, You are not in a vehicle!!


Re: How would I do this?(If get player state) - Kirollos - 12.09.2012

pawn Код:
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER))
{
    SendClientMessage(playerid, -1, "ERROR: You are not in a vehicle!");
    return 1;
}



Re: How would I do this?(If get player state) - Cypress - 12.09.2012

pawn Код:
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)

EDIT:

Quote:
Originally Posted by kirollos
Посмотреть сообщение
pawn Код:
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER))
{
    SendClientMessage(playerid, -1, "ERROR: You are not in a vehicle!");
    return 1;
}
You don't need to keep those 2 braces.


Re: How would I do this?(If get player state) - UnknownGamer - 12.09.2012

How would I do

I get error.

if(!IsPlayerInVehicle(playerid))


Re: How would I do this?(If get player state) - C00K13M0N$73R - 12.09.2012

if(!IsPlayerInAnyVehicle(playerid));
or
if(IsPlayerInVehicle(playerid,vehicleid));


Re: How would I do this?(If get player state) - Cypress - 12.09.2012

I think you want to check if the player is not in any vehicle not in a specified vehicleid.

pawn Код:
if(!IsPlayerInAnyVehicle(playerid))
you can also take a look on those pages above

https://sampwiki.blast.hk/wiki/Function:IsPlayerInVehicle
https://sampwiki.blast.hk/wiki/IsPlayerInAnyVehicle

EDIT: too late as always