OnPlayerKeyStateChange
#1

pawn Код:
if(newkeys == KEY_YES)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(IsPlayerConnected(playerid))
            {
                    if(IsAnOwnableCar(newcar))
                    {
                        if(PlayerInfo[playerid][pPcarkey] == newcar) { }
                        else if(PlayerInfo[playerid][pPcarkey2] == newcar) { }
                        else if(PlayerInfo[playerid][pPcarkey3] == newcar) { }
                        else { return 1; }
                      format(string, sizeof(string), "* %s Turned On Car lights.", sendername);
                     ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                     GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
                    SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, 1, alarm, doors, bonnet, boot, objective);
                    return 1;
    }
            }
        }
    }
            if(newkeys == KEY_NO)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(IsPlayerConnected(playerid))
            {
                    if(IsAnOwnableCar(newcar))
                    {
                        if(PlayerInfo[playerid][pPcarkey] == newcar) { }
                        else if(PlayerInfo[playerid][pPcarkey2] == newcar) { }
                        else if(PlayerInfo[playerid][pPcarkey3] == newcar) { }
                        else { return 1; }
                      format(string, sizeof(string), "* %s Turned Off Car lights", sendername);
                     ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                     GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
                    SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, 0, alarm, doors, bonnet, boot, objective);
                    return 1;
    }
            }
        }
    }
\nothing happens please help
Reply
#2

You probably have to use ManualVehicleEngineAndLights. Also remove the "if(IsPlayerConnected(playerid))". Both of them are useless in your code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)