SA-MP Forums Archive
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=656274)



OnPlayerStateChange - TuNiSiAnO1 - 11.07.2018

Hello i want if player get in ambulance he gets message type /paramdic to start the job this code dosent work it sends nothing to me

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
       
         if(GetVehicleModel(GetPlayerVehicleID(playerid) == 416)
         {
            SendClientMessage(playerid,Red,"Type /paramidc to start job");  
         }
    }
    return 1;
}



Re: OnPlayerStateChange - Caessius - 11.07.2018

You should rather use OnPlayerEnterVehicle callback for this, since you're relating this completely to vehicles.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 416)
    {
        SendClientMessage(playerid,Red,"Type /paramidc to start job");
    }
    return 1;
}



Re: OnPlayerStateChange - David (Sabljak) - 11.07.2018

Just try

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
         if(GetVehicleModel(GetPlayerVehicleID(playerid) == 416)
         {
            SendClientMessage(playerid,Red,"Type /paramidc to start job");  
         }
    }
    return 1;
}
EDIT; someone posted before, nvm...