OnPlayerStateChange function help..
#1

Hello guys
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  new vehicleid = GetPlayerVehicleID(playerid);
  if(newstate == PLAYER_STATE_DRIVER)
   {
        if(Engine[vehicleid] == 0)
        {
        TogglePlayerControllable(playerid, 0);
        SendClientMessage(playerid, COLOR_YELLOW, "((use /e to turn the vehicle engine on))");
        if(newkeys & KEY_SECONDARY_ATTACK)
        {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, 1);
        }
        else if(Engine[vehicleid] == 1)
        {
        SendClientMessage(playerid, COLOR_YELLOW, "Engine Running...");
        TogglePlayerControllable(playerid, 1);
        }
    }
}
    return 1;
}
I'm recieving this error
pawn Код:
C:\Users\dell\Desktop\Script\gamemodes\hrp.pwn(682) : error 017: undefined symbol "newkeys"
C:\Users\dell\Desktop\Script\gamemodes\hrp.pwn(694) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
can someone help me out please
Reply
#2

OnPlayerStateChange and OnPlayerKeyStateChange differ from each other.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(!Engine[GetPlayerVehicleID(playerid)])
        {
            TogglePlayerControllable(playerid, 0);
            SendClientMessage(playerid, COLOR_YELLOW, "((use /e to turn the vehicle engine on))");
        }
        else
        {
            TogglePlayerControllable(playerid, 1);
            SendClientMessage(playerid, COLOR_YELLOW, "Engine Running...");
        }
    }
    return 1;
}
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SECONDARY_ATTACK)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && !Engine[GetPlayerVehicleID(playerid)])
        {
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid, 1);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)