OnPlayerStateChange - 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: OnPlayerStateChange (
/showthread.php?tid=552610)
OnPlayerStateChange -
kesarthakur - 25.12.2014
pawn Код:
static CurrVehicleID[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(IsAdminv(CurrVehicleID[playerid]))
{
if(PlayerInfo[playerid][Admin] < 1)
{
if(oldstate == PLAYER_STATE_DRIVER) DestroyVehicle(CurrVehicleID[playerid]);
SendClientMessage(playerid, 0xFF0000FF, ""RED"ERROR:"GREY" Unauthorized Vehicle");
}
}
CurrVehicleID[playerid] = GetPlayerVehicleID(playerid);
}
return 1;
}
stock IsAdminv(vehicleid)
{
new result;
new model = GetVehicleModel(vehicleid);
switch(model)
{
case 425, 432, 447, 430, 449, 476, 520, 537, 538, 569, 570, 577, 590, 592, 610: result = model;
default: result = 0;
}
return result;
}
It should destroy vehicle and send client message but it is only sending client message...
plz help me to fix this
it should destroy vehicle and send error message
Thanks in advance
Reply -
Ygzeb - 25.12.2014
You should delete this if:
pawn Код:
if(oldstate == PLAYER_STATE_DRIVER)
You are defining that the last state was "driver" and then he changed to the state of driver... So it has no sense as he is now a driver and was a driver before.
Re: Reply -
kesarthakur - 25.12.2014
Quote:
Originally Posted by Ygzeb
You should delete this if:
pawn Код:
if(oldstate == PLAYER_STATE_DRIVER)
You are defining that the last state was "driver" and then he changed to the state of driver... So it has no sense as he is now a driver and was a driver before.
|
it has sense...
if player was in a normal vehicle and changes to unauthorized vehicle it should be deleted