CarID problem - 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: CarID problem (
/showthread.php?tid=81194)
CarID problem -
JoeDaDude - 08.06.2009
Ok. Im making a car command which tells u what car your in,
And its not all completed but when i say the command, If im not in a car it will send a message saying Car: [NotYetKnown] But it should only say your not in a car, but it does say it, but also says the other,
pawn Код:
if(!strcmp("/carid", cmdtext, true))
{
IsPlayerInAnyVehicle(playerid);
new name[ 24 ], string[ 64 ];
GetPlayerName( playerid, name, 24 );
format( string, sizeof(string), "~w~CAR: [NotYetKnown]", name );
GameTextForAll( string, 5000, 1 );
}
else
{
SendClientMessage(playerid, 0xFFFFFFFFF, "You are not in a car");
return 1;
}
Whats wrong?
Why if im in or out a car,
It says both: CAR: [NotYetKnown] and also You are not in a car,
So whats the problem?
If im on foot and say the command,
It says your not in a car AND says CAR: [NotYetKnown]
But it should only say your not in a car,
Anyone help
Re: CarID problem -
yezizhu - 09.06.2009
Hi,,where's "if"?
pawn Код:
IsPlayerInAnyVehicle(playerid);
And I suggest use GetPlayerVehicleID
pawn Код:
if(!strcmp(...)){
if(GetPlayerVehicleID(playerid)) printf "id:%d,%d",playerid,GetPlayerVehicleID(playerid);
else print "not in vec"
return true;
}
Re: CarID problem -
[HiC]TheKiller - 09.06.2009
Quote:
Originally Posted by yezizhu
Hi,,where's "if"?
pawn Код:
IsPlayerInAnyVehicle(playerid);
And I suggest use GetPlayerVehicleID
pawn Код:
if(!strcmp(...)){ if(GetPlayerVehicleID(playerid)) printf "id:%d,%d",playerid,GetPlayerVehicleID(playerid); else print "not in vec" return true; }
|
pawn Код:
if(!strcmp(...))
{
if(IsPlayerInAnyVehicle(playerid) == true)
{
printf("id:%d,%d",playerid,GetPlayerVehicleID(playerid));
}
else
{
print("not in vehicle");
}
return 1;
}