SA-MP Forums Archive
How to check if player is in car - 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 to check if player is in car (/showthread.php?tid=81581)



How to check if player is in car - JoeDaDude - 12.06.2009

How do i check to see if the idis in a car,
It already checks to see if the player is connected,
And also sends a usage...
But how to check if the guy who said the command and the guy he is cuffing,
are in a copcar? I know how but its already checking for player connected and sendin a usage,

pawn Code:
new index;
new cmd[20];
cmd = strtok(cmdtext, index);
if (strcmp(cmd, "/cuff", true) == 0)
{
new tmp[20];
tmp = strtok(cmdtext, index);
if (strlen(tmp))
{
id = strval(tmp);
if (IsPlayerConnected(id))
{
SendClientMessage(id, 0xFFFFFFFFF, "You have been cuffed and cannot move");
TogglePlayerControllable(id,0);
return 1;
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Player not found");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "[Usage]: /cuff [playerid/name]");
}
return 1;
}



Re: How to check if player is in car - wijnkamp - 12.06.2009

Is this what u looking for ?

if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {

if(IsPlayerInAnyVehicle(playerid)) {


Re: How to check if player is in car - JoeDaDude - 12.06.2009

Yes but im not sure where to add it without it getting confused with PlayerConnected n Usage


Re: How to check if player is in car - wijnkamp - 12.06.2009

i sended u a pastebin by pm.



Re: How to check if player is in car - JoeDaDude - 12.06.2009

Quote:
Originally Posted by wijnkamp
hold on i send you a pastebin how i got it..!
Er... Kk


Re: How to check if player is in car - nickbouwhuis - 20.10.2012

Don't do it in PM's, you can help others if you just post it here


Re: How to check if player is in car - JaKe Elite - 20.10.2012

^^

Sorry if i'm insult you but are you blind?
This topic is made since 2009..

Bumping it?


Re: How to check if player is in car - M3mPHi$_S3 - 20.10.2012

PHP Code:

else
{
if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFF0000AA"Playeris in vehicle so cant be cuffed.");

You mean this ? If so add this