SA-MP Forums Archive
Blocking keys on race - 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: Blocking keys on race (/showthread.php?tid=562759)



Blocking keys on race - SecretBoss - 11.02.2015

Hello guys, today I faced a problem with the Race System where I installed in my server

I have this

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SUBMISSION) {
        if (IsPlayerInAnyVehicle(playerid)){
        {
            new currentveh;
            new Float:angle;
            RepairVehicle(GetPlayerVehicleID(playerid));
            SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
            currentveh = GetPlayerVehicleID(playerid);
            GetVehicleZAngle(currentveh, angle);
            SetVehicleZAngle(currentveh, angle);
            SendClientMessage(playerid, -1, ""green"[NGC] "red"Vehicle Flipped and Repaired");
            }
        }
    }
    if(newkeys & KEY_FIRE) {
        if (IsPlayerInAnyVehicle(playerid)){
        {
            new Float:vx, Float:vy, Float:vz;
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
            GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
            SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx * 1.5,vy * 1.5 ,vz * 1.5);
            }
        }
    }
    if(newkeys & KEY_CROUCH) {
        if (IsPlayerInAnyVehicle(playerid)){
        {
            new Float:x, Float:y, Float:z;
            GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
            SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y ,z+0.3);
            }
        }
    }
    return 1;
}
So when a player will be in a race he/she will not be able to use these commands also I want to block some commands when the player is in race

I have already a fuction

pawn Код:
IsPlayerInRace(playerid)
+REP to everyone who will help me


Re: Blocking keys on race - Sime30 - 11.02.2015

if(IsPlayerInRace(playerid)) return 1;


Re: Blocking keys on race - SecretBoss - 11.02.2015

Thanks +REP