23.05.2012, 17:36
How can I make a few classes restricted so only players with a tag can use it-..?
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name));
if(strfind(name, "[ABK]", false) != -1)
{
//do stuff
}
SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0)
{
gTeam[playerid] = TEAM_MAFIA;
GameTextForPlayer(playerid, "Mafia", 2000, 5);
}
else if(classid == 1)
{
gTeam[playerid] = TEAM_MAFIA;
GameTextForPlayer(playerid, "Mafia", 2000, 5);
}
else if(classid == 2)
{
gTeam[playerid] = TEAM_MAFIA;
GameTextForPlayer(playerid, "Mafia", 2000, 5);
}
else if(classid == 3)
{
gTeam[playerid] = TEAM_POLICE;
GameTextForPlayer(playerid, "Police", 2000, 5);
}
else if(classid == 4)
{
gTeam[playerid] = TEAM_POLICE;
GameTextForPlayer(playerid, "Police", 2000, 5);
}
else if(classid == 5)
{
gTeam[playerid] = TEAM_POLICE;
GameTextForPlayer(playerid, "Police", 2000, 5);
}
else if(classid == 6)
{
gTeam[playerid] = TEAM_GROVE;
GameTextForPlayer(playerid, "Grove", 2000, 5);
}
else if(classid == 7)
{
gTeam[playerid] = TEAM_GROVE;
GameTextForPlayer(playerid, "Grove", 2000, 5);
}
else if(classid == 8)
{
gTeam[playerid] = TEAM_GROVE;
GameTextForPlayer(playerid, "Grove", 2000, 5);
}
else if(classid == 9)
{
gTeam[playerid] = TEAM_BALLAS;
GameTextForPlayer(playerid, "Ballas", 2000, 5);
}
else if(classid == 10)
{
gTeam[playerid] = TEAM_BALLAS;
GameTextForPlayer(playerid, "Ballas", 2000, 5);
}
else if(classid == 11)
{
gTeam[playerid] = TEAM_BALLAS;
GameTextForPlayer(playerid, "Ballas", 2000, 5);
}
else if(classid == 12)
{
gTeam[playerid] = TEAM_BIKERS;
GameTextForPlayer(playerid, "Bikers", 2000, 5);
}
else if(classid == 13)
{
gTeam[playerid] = TEAM_BIKERS;
GameTextForPlayer(playerid, "Bikers", 2000, 5);
}
else if(classid == 14)
{
gTeam[playerid] = TEAM_BIKERS;
GameTextForPlayer(playerid, "Bikers", 2000, 5);
}
else if(classid == 15)
{
gTeam[playerid] = TEAM_QK;
GameTextForPlayer(playerid, "qK Clan", 2000, 5);
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name));
if(strfind(name, "[qK]", false) != -1)
{
SendClientMessage(playerid, COLOR_ORANGE, "You are not a [qK] member so this team is restricted.");
}
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
if(gTeam[playerid] == TEAM_QK)
{
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name));
if(strfind(name, "[qK]", false) != -1)
{
SendClientMessage(playerid, COLOR_ORANGE, "You are not a [qK] member. This team is restricted.");
return 0;
}
}
return 1;
}
SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0)
{
gTeam[playerid] = TEAM_MAFIA;
GameTextForPlayer(playerid, "Mafia", 2000, 5);
}
else if(classid == 1)
{
gTeam[playerid] = TEAM_MAFIA;
GameTextForPlayer(playerid, "Mafia", 2000, 5);
}
else if(classid == 2)
{
gTeam[playerid] = TEAM_MAFIA;
GameTextForPlayer(playerid, "Mafia", 2000, 5);
}
else if(classid == 3)
{
gTeam[playerid] = TEAM_POLICE;
GameTextForPlayer(playerid, "Police", 2000, 5);
}
else if(classid == 4)
{
gTeam[playerid] = TEAM_POLICE;
GameTextForPlayer(playerid, "Police", 2000, 5);
}
else if(classid == 5)
{
gTeam[playerid] = TEAM_POLICE;
GameTextForPlayer(playerid, "Police", 2000, 5);
}
else if(classid == 6)
{
gTeam[playerid] = TEAM_GROVE;
GameTextForPlayer(playerid, "Grove", 2000, 5);
}
else if(classid == 7)
{
gTeam[playerid] = TEAM_GROVE;
GameTextForPlayer(playerid, "Grove", 2000, 5);
}
else if(classid == 8)
{
gTeam[playerid] = TEAM_GROVE;
GameTextForPlayer(playerid, "Grove", 2000, 5);
}
else if(classid == 9)
{
gTeam[playerid] = TEAM_BALLAS;
GameTextForPlayer(playerid, "Ballas", 2000, 5);
}
else if(classid == 10)
{
gTeam[playerid] = TEAM_BALLAS;
GameTextForPlayer(playerid, "Ballas", 2000, 5);
}
else if(classid == 11)
{
gTeam[playerid] = TEAM_BALLAS;
GameTextForPlayer(playerid, "Ballas", 2000, 5);
}
else if(classid == 12)
{
gTeam[playerid] = TEAM_BIKERS;
GameTextForPlayer(playerid, "Bikers", 2000, 5);
}
else if(classid == 13)
{
gTeam[playerid] = TEAM_BIKERS;
GameTextForPlayer(playerid, "Bikers", 2000, 5);
}
else if(classid == 14)
{
gTeam[playerid] = TEAM_BIKERS;
GameTextForPlayer(playerid, "Bikers", 2000, 5);
}
else if(classid == 15)
{
new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name));
if(strfind(name, "[qK]", false) != -1)
{
SendClientMessage(playerid, COLOR_ORANGE, "You are not a [qK] member so this team is restricted.");
return 0;
}
gTeam[playerid] = TEAM_QK;
GameTextForPlayer(playerid, "qK Clan", 2000, 5);
}
return 1;
}