07.05.2013, 15:12
On Player Character Selection , if this player police , he cant select medical worker's team skin , how can I do it ? or just tell me how to do not let select the character ? tell me just thx ...
public OnPlayerRequestClass(playerid, classid)
{
TextDrawHideForPlayer(playerid, CSTailText);
TextDrawHideForPlayer(playerid, CSTailExtra);
TextDrawShowForPlayer(playerid,CSScreenText);
PlayerPlaySound(playerid,1183,-86.2111,-224.1556,80.1250);
/* You pos,etc stuff go here*/
PlayerInfo[playerid][Skin] = GetPlayerSkin(playerid);
switch(PlayerInfo[playerid][Skin])
{
case 280,281,282,283,284,285:
{
if(PlayerInfo[playerid][Team] != COP) return ShowTextMessage(playerid,"You can't use this class");
ShowTextMessage(playerid,"~b~COPS");
//COPS
}
case 275,276:
{
if(PlayerInfo[playerid][Team] != MEDIC) return ShowTextMessage(playerid,"You can't use this class");
ShowTextMessage(playerid,"~p~MEDIC");
//MEDIC
}
case 264,211,217,204,187,26,81,23,82,77,66,30,29,249,224,181,195,194,198,33,197,251:
{
if(PlayerInfo[playerid][Team] != COP) return ShowTextMessage(playerid,"You can't use this class");
ShowTextMessage(playerid,"~w~Civilian");
// CIVIL
}
}
return 1;
}
public OnPlayerSpawn(playerid)
{
switch(PlayerInfo[playerid][Skin]
{
case 275,276:
{
if(PlayerInfo[playerid][Team] != MEDIC) { ForceClassSelection(playerid); SetPlayerHealth(0); return 1; }//Not sure if kill is required
}
}
}
public OnPlayerRequestClass(playerid,classid)
{
pClass[playerid] = classid;
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
if(pClass[playerid] == 11 && GetPlayerScore(playerid) < 1000)
{
SendClientMessage(playerid,-1,"You're too young to be a cop!");
return 0; // It means not spawn, and keep the player at class selection, till he choose a valid class for him.
}
return 1;
}
|
Create a per-player variable to store the skin at OnPlayerRequestClass.
At OnPlayerRequestSpawn, check if the skin is enabled for playerid to prevent him from spawn. pawn Код:
|
, will update my code too.