07.05.2013, 15:19
Something like this will do
This gets the skin ID and puts it in a switch and the skin ID is checked if it matches,if it does then a check on the players team is done to see if the player can use that skin if not a message is shown.And if he hits Spawn with the wrong skin id a check is once again done on OnPlayerSpawn and is forced a class selection again to select another skin.
and OnPlayerSpawn if he presses Spawn with the wrong skin then ForceClassSelection(playerid) and kill the player(I dont know if the kill is required)
There might be much better optimized way, I just gave an idea how it can be done.
This gets the skin ID and puts it in a switch and the skin ID is checked if it matches,if it does then a check on the players team is done to see if the player can use that skin if not a message is shown.And if he hits Spawn with the wrong skin id a check is once again done on OnPlayerSpawn and is forced a class selection again to select another skin.
Код:
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
}
}
}

