SA-MP Forums Archive
Is it possible? - 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: Is it possible? (/showthread.php?tid=438249)



Is it possible? - Rayan_black - 19.05.2013

Well, I'm here to ask if it's possible to disable F4 and prevent it from changing your class/team?


Re: Is it possible? - Revo - 19.05.2013

Please use the forum search function, this has been handled before.


Re: Is it possible? - GreTex - 19.05.2013

Just spawn them when they reach the class selection menu unless they used the command previously


Re: Is it possible? - Rayan_black - 19.05.2013

Well, if it's handled before can you please tell me how?.. The only way I know to disable it is to return 0 in OnPlayerRequestClass, but I need that callback so that's not a solution, one of my community scripter is working on a command to disable /switchteam, but we need to know if there's a way to prevent people from using F4.


Re: Is it possible? - Faisal_khan - 19.05.2013

Make a variable, assign it's value to 1 when the player connects. Then check if the value is 1 under OnPlayerRequestClass, if it is, then let the player choose the skin and then set the value to 0. If the value is 0 under OnPlayerRequest class then respawn the player. Hope this might work out.


Re: Is it possible? - Rayan_black - 19.05.2013

Already did that, and it works perfectly but some people bypass it by using F4..


Re: Is it possible? - Faisal_khan - 19.05.2013

But how the player gets the value 1 by hitting F4? That ain't possible.

Wait lemme try it out.


Re: Is it possible? - Faisal_khan - 19.05.2013

Give this a try and let me know if it works:
pawn Код:
new F4[MAX_PLAYERS];
public OnPlayerRequestClass(playerid, classid)
{
    if(F4[playerid] == 1)
    {
        SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
        F4[playerid] = 0;
        print("value found to be 1");
        print("value set to be 0");
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    F4[playerid] = 1;
    print("Value set to 1");
    return 1;
}



Re: Is it possible? - Rayan_black - 19.05.2013

Didn't work.. still F4 bypasses it.


Re: Is it possible? - Tamer - 19.05.2013

I don't know if this can help you or not,but here's a plugin that detects keys.
https://sampforum.blast.hk/showthread.php?tid=268671