SA-MP Forums Archive
onkeypressed problem - 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: onkeypressed problem (/showthread.php?tid=598484)



onkeypressed problem - KillerStrike23 - 13.01.2016

pawn Код:
if(newkeys & KEY_FIRE)
    {
        if(PlayerInfo[playerid][Level] >=1) {
            if (IsPlayerInAnyVehicle(playerid))
            {
                if((GetPlayerVehicleID(playerid) == 520) || (GetPlayerVehicleID(playerid) == 425) || (GetPlayerVehicleID(playerid) == 464)) {
                    return 1;
                }
                else {
                    new Float:vx, Float:vy, Float:vz;
                    GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
                    SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx*2,vy*2 ,vz*2);
                }
            }
        }
    }
    if(newkeys & KEY_JUMP) {
        if(PlayerInfo[playerid][Level] >=1) {
            if (IsPlayerInAnyVehicle(playerid))
            {
                new Float:vx, Float:vy, Float:vz;
                GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
                SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx/1.7,vy/1.7 ,vz/1.7);
            }
        }
    }
    if(newkeys & KEY_SPRINT)
    {
        if(PlayerInfo[playerid][Level] >=1) {
            if (GetPlayerVehicleID(playerid))
            {
                AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
            }
        }
    }
sup all am trying to make the following statements:
- When the player presses left shit, the car should stop
- When the player presses left ctrl, A nitro should be added to the car
- When the player presses left alt, the car speed should be maximized

above is my codes but the stop thing is not working and the keys are mixed not as above!