Preventing player from spawn - 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: Preventing player from spawn (
/showthread.php?tid=592791)
Preventing player from spawn -
lucamsx - 29.10.2015
how can i prevent player to spawn with a specified skin if he has selected value (for e.g 0 instead of 1) in some variable?
i mean, using OnPlayerRequestSpawn and returning 0 doesn't work for me, are there any other methods?
Re: Preventing player from spawn -
Abagail - 30.10.2015
If you are using class selection, you can use the OnPlayerRequestClass callback like the following:
pawn Код:
new bool: PlayerIsAdmin[MAX_PLAYERS] = false;
public OnPlayerRequestClass(playerid, classid)
{
if(classid == 50 && !PlayerIsAdmin[playerid])
{
SendClientMessage(playerid, -1, "You are not an admin, you cannot use this class.");
return 0;
}
return 1;
}
Re: Preventing player from spawn -
Karan007 - 30.10.2015
Well, use OnPlayerRequestSpawn to check for that.
Re: Preventing player from spawn -
iKarim - 30.10.2015
PHP код:
public OnPlayerRequestClass(playerid, classid)
{
SetPVarInt(playerid, "class", classid);
return 1;
}
PHP код:
public OnPlayerRequestSpawn(playerid)
{
new class;
class = GetPVarInt(playerid, "class");
if(class == 217 && !IsPlayerAdmin(playerid)) // change to whatever class you want to make it for admins only.
{
GameTextForPlayer(playerid, "You can't use admin skins.", 3000, 5);
return 0;
}
return 1;
}