[Solved]Removing player from a specific vehicle. - 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: [Solved]Removing player from a specific vehicle. (
/showthread.php?tid=74828)
[Solved]Removing player from a specific vehicle. -
ReV. - 26.04.2009
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid) == 425 || 520 || 432))
{
if(DMZone[playerid] == 0)
{
//Do nothing
}
else
{
SendClientMessage(playerid,RED,"Go to a DM to use this car.");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
For some reason the GetVehicleModel is completely ignored, It removes the player from any vehicle in a DM zone. Anyone know what's wrong?
Any help would be appreciated.
EDIT: Solved, Thank you very much Andom and Finn
Re: Removing player from a specific vehicle. -
MachineHead - 26.04.2009
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 425 || 520 || 432)
{
if(DMZone[playerid] == 0)
{
//Do nothing
}
else
{
SendClientMessage(playerid,RED,"Go to a DM to use this car.");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
Try that.
Re: Removing player from a specific vehicle. -
Andom - 26.04.2009
Lol, change:
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid) == 425 || 520 || 432))
To:
pawn Код:
new vehiclemod = GetVehicleModel(GetPlayerVehicleID(playerid));
if(vehiclemod == 425 || vehiclemod == 520 || vehiclemod == 432))
Re: Removing player from a specific vehicle. -
ReV. - 26.04.2009
Quote:
Originally Posted by xClumx``
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT) { if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 425 || 520 || 432) { if(DMZone[playerid] == 0) { //Do nothing } else { SendClientMessage(playerid,RED,"Go to a DM to use this car."); RemovePlayerFromVehicle(playerid); } } } return 1; }
Try that.
|
Same result :S
Quote:
Originally Posted by Andom
Lol, change:
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid) == 425 || 520 || 432))
To:
pawn Код:
new vehiclemod = GetVehicleModel(GetPlayerVehicleID(playerid)); if(vehiclemod == 425 || vehiclemod == 520 || vehiclemod == 432))
|
All you did is add a variable?..It's the same thing, and you still did it wrong, It supposed to be, if(vehiclemod == 425 || 520 || 432)
Anyway, anyone know the problem?
Re: Removing player from a specific vehicle. -
Finn - 26.04.2009
Quote:
Originally Posted by :\
Anyway, anyone know the problem?
|
Just do what Andom said and it will work.
CORRECT:
pawn Код:
if(vehiclemod == 425 || vehiclemod == 520 || vehiclemod == 432)
WRONG:
pawn Код:
if(vehiclemod == 425 || 520 || 432)