[Include] Disable class selection
#1

Disable class selection

This include allows you to disable class selection with ease, without playing around with the spectator functions.

You can also use this include to hide the class selection buttons without spawning the player.

Usage
All you need to do is include it after a_samp:

pawn Code:
#include <a_samp>
#include <noclass>
This works by enabling spectator mode in OnPlayerRequestClass() to hide the class selection buttons. There is one callback available:

pawn Code:
// Called when a player has fully connected to the server.
public OnPlayerFullyConnected(playerid);
After OnPlayerRequestClass has been called and the buttons have been hidden, the callback above will be called.

It can be used to show the login dialog, spawn the player, or set the player's camera.

Spawning the player
Use SpawnPlayer() to simply spawn the player after they are done logging in or whatever.

pawn Code:
public OnPlayerLogin(playerid)
{
    if (cache_get_row_count(gConnection))
    {
        SetSpawnInfo(playerid, NO_TEAM, 255, 1280.0, -1024.0, 20.0, 180.0, 0, 0, 0, 0, 0, 0);
        SpawnPlayer(playerid);
    }
}
There is a bug in SA-MP where using SpawnPlayer after TogglePlayerSpectating will kick you. In this instance, you can safely spawn a player without any problems.

Disable class selection
If you want to completely disable class selection and spawn the player after they connect, do this:

pawn Code:
public OnPlayerFullyConnected(playerid)
{
    SpawnPlayer(playerid);
}
Download
https://www.dropbox.com/s/eawh6oo8z7...class.inc?dl=1
Reply


Messages In This Thread
Disable class selection - by Emmet_ - 13.05.2015, 10:57
Re: Disable class selection - by Crayder - 13.05.2015, 11:16
Re: Disable class selection - by ZiGGi - 13.05.2015, 12:29
Re: Disable class selection - by Emmet_ - 13.05.2015, 12:32
Re: Disable class selection - by ZiGGi - 13.05.2015, 12:44
Re: Disable class selection - by Gammix - 13.05.2015, 13:40
Re: Disable class selection - by theYiin - 24.05.2015, 11:36
Re: Disable class selection - by FplayerGR - 24.05.2015, 15:24
Re: Disable class selection - by ZiGGi - 24.05.2015, 16:25
Re: Disable class selection - by PT - 24.05.2015, 16:42

Forum Jump:


Users browsing this thread: 1 Guest(s)