SA-MP Forums Archive
How to disable class selection? - 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: How to disable class selection? (/showthread.php?tid=433364)



How to disable class selection? - lQs - 27.04.2013

Hi, i have problem. In my RP gamemode if someone dies, he come back to class selection. How to disable that piece of shit?

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInfo[killerid][pKills]++;
    PlayerInfo[playerid][pDeaths]++;
    SetPlayerPos(playerid,  982.1890, -1624.2583, 14.9526);
    SetPlayerFacingAngle(playerid, 90);
    return 1;
}



Re: How to disable class selection? - Tamer - 27.04.2013

pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
    SpawnPlayer(playerid);
    return 1;
}



Re: How to disable class selection? - Lordzy - 27.04.2013

There's nothing specified here which takes the player back to class selection, but it does if player has pressed 'F4' and then after death, it takes to class selection which is provided by SA-MP.

pawn Код:
new _PlayerSpawns[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
 _PlayerSpawns[playerid] = 0;
 return 1;
}

public OnPlayerRequestClass(playerid)
{
 if(_PlayerSpawns[playerid] == 1) return Spawn(playerid);
 return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
 _PlayerSpawns[playerid] = 1;
 return 1;
}

public OnPlayerSpawn(playerid)
{
 _PlayerSpawns[playerid] = 0;
 return 1;
}
The above code will prevent player from going back to class selection after death even if the player has enabled 'F4'. It might take to class, but will spawn suddenly so that the player won't be able to choose another class. Also, the variable isn't for calculating the number of spawns here, it's to balance it so that player won't go back to spawn selection even if 'F4' is toggled after before death / after death.


Re: How to disable class selection? - ]Rafaellos[ - 27.04.2013

Is
pawn Код:
SetPlayerPos(playerid,  982.1890, -1624.2583, 14.9526);
SetPlayerFacingAngle(playerid, 90);
necessary? When you die your teleport back to your first spawnpoint. If this coods are the same with spawn, then delete it.


Re: How to disable class selection? - lQs - 27.04.2013

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
Is
pawn Код:
SetPlayerPos(playerid,  982.1890, -1624.2583, 14.9526);
SetPlayerFacingAngle(playerid, 90);
necessary? When you die your teleport back to your first spawnpoint. If this coods are the same with spawn, then delete it.
If i delete it it doesnt tp me when im changing skin at skin select, but after i choose one it tps me to spawnpoint.


Re: How to disable class selection? - Gomuk - 27.04.2013

It's set correct, you are done,


Re: How to disable class selection? - lQs - 27.04.2013

Quote:
Originally Posted by Tamer T
Посмотреть сообщение
pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
    SpawnPlayer(playerid);
    return 1;
}
Thanks, i fixed it by this code.
+ repped.