07.05.2009, 16:10
I made a /quitfaction command but when players use it they have the same skin and team
even though i have set the [pSkin] and [pTeam]
even though i have set the [pSkin] and [pTeam]
if(strcmp(cmd, "/quitfaction", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, " /quitfaction ");
return 1;
}
if(PlayerInfo[playerid][pMember] >= 1)
{
format(string, sizeof(string), "You have left your faction.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
gTeam[playerid] = 3;
SetPlayerHealth(playerid, 0);
PlayerInfo[playerid][pTeam] = 3;
PlayerInfo[playerid][pLeader] = 0;
PlayerInfo[playerid][pMember] = 0;
PlayerInfo[playerid][pRank] = 0;
PlayerInfo[playerid][pChar] = 0;
new rand = random(sizeof(CIV));
SetSpawnInfo(playerid, gTeam[playerid], CIV[rand],0.0,0.0,0.0,0,0,0,0,0,0,0);
PlayerInfo[playerid][pModel] = CIV[rand];
MedicBill[playerid] = 0;
SpawnPlayer(playerid);
}
}//not connected
}
return 1;
}
if(strcmp(cmd, "/quitteam", true) == 0)
{
if(PlayerInfo[playerid][pMember] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You are Civilian. Can't do that !");
return 1;
}
if(PlayerInfo[playerid][pLeader] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Ask an admin to remove your leader !");
return 1;
}
SendClientMessage(playerid, COLOR_BLUE, "You are now a Civilian again !");
PlayerInfo[playerid][pMember] = 0;
PlayerInfo[playerid][pTeam] = 3;
gTeam[playerid] = 3;
PlayerInfo[playerid][pRank] = 0;
PlayerInfo[playerid][pLeader] = 0;
PlayerInfo[playerid][pChar] = 0;
SetPlayerToTeamColor(playerid);
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
return 1;
}
if(strcmp(cmd, "/quitteam", true) == 0) { if(PlayerInfo[playerid][pMember] == 0) { SendClientMessage(playerid, COLOR_GREY, " You are Civilian. Can't do that !"); return 1; } if(PlayerInfo[playerid][pLeader] > 0) { SendClientMessage(playerid, COLOR_GREY, " Ask an admin to remove your leader !"); return 1; } { SendClientMessage(playerid, COLOR_YELLOW, "You are now a Civilian again !"); PlayerInfo[playerid][pMember] = 0; PlayerInfo[playerid][pTeam] = 3; gTeam[playerid] = 3; PlayerInfo[playerid][pRank] = 0; PlayerInfo[playerid][pLeader] = 0; PlayerInfo[playerid][pChar] = 0; SetPlayerToTeamColor(playerid); SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]); return 1; } }