OnPlayerStateChange
#1

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
#2

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.
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)