new whatteam[MAX_PLAYERS];
whatteam[playerid] = 1;
if(whatteam[playerid] ==1) { SendClientMessage(playerid,-1,"This player is cop"); }
#define TEAM_POLICE 0
#define TEAM_MAFIA 1
#define TEAM_BLAH 2
#define TEAM_CIVILIAN 3
new teamNames[][] = {
{"Police"},
{"Mafia"},
{"Blah"},
{"Civilian"}
};
GetPlayerTeamName(playerid)
{
new name[24];
format(name, sizeof name, "%s", teamNames[GetPlayerTeam(playerid)]);
return name;
}
new gTeam[MAX_PLAYERS];
new gPlayerClass[MAX_PLAYERS];
///Player Classes
forward SetPlayerTeamFromClass(playerid, classid);
public SetPlayerTeamFromClass(playerid, classid)
{
SetupPlayerForClassSelection(playerid,classid);
gPlayerClass[playerid] = classid;
{
if (classid == 0 || classid == 1 || classid == 2 || classid == 3 || classid == 4 || classid == 5 || classid == 6 || classid == 7 || classid == 8 || classid == 9 || classid == 10 || classid == 11)
{
gTeam[playerid] = COPS;
GameTextForPlayer(playerid, "~b~POLICE OFFICER", 600, 5);
return 1;
}
else if (classid == 12 )
{
gTeam[playerid] = ARMY;
GameTextForPlayer(playerid, "~b~~h~ARMY", 500, 5);
return 1;
}
else if (classid == 13)
{
gTeam[playerid] = FBI;
GameTextForPlayer(playerid, "~b~FBI", 500, 5);
return 1;
}
else if (classid == 14 || classid == 15 || classid == 16)
{
gTeam[playerid] = CIA;
GameTextForPlayer(playerid, "~w~CIA", 500, 5);
return 1;
}
else if (classid == 17 || classid == 18 || classid == 19 || classid == 20)
{
gTeam[playerid] = MEDICS;
GameTextForPlayer(playerid, "~p~~h~MEDIC", 500, 5);
return 1;
}
else if (classid >= 21)
{
gTeam[playerid] = CIVILIANS;
GameTextForPlayer(playerid, "~w~CIVILIAN", 500, 5);
return 1;
}
return 1;
}
}
forward OnPlayerSave(playerid);
public OnPlayerSave(playerid)
{
new query[500];
if(IsLoggedIn[playerid] == 1 && playerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid))
{
mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `Vip`=%d, `Money`=%d, `Score`=%d, `Deaths`=%d, `Kills`=%d, `SkinID`=%d, `Robbed`=%d, `RobbedMoney`=%d, `GotRobbed`=%d, `GotRobbedMoney`=%d, `StoreRobbed`=%d, `StoreRobbedMoney`=%d, `FoodPurchased`=%d, `FoodPurchasedMoney`=%d, `WeaponsPurchased`=%d, `WeaponsPurchasedMoney`=%d WHERE `ID`=%d AND `user`='%e'",
pInfo[playerid][pAdmin],
pInfo[playerid][pVip],
GetPlayerMoney(playerid),
GetPlayerScore(playerid),
pInfo[playerid][pDeaths],
pInfo[playerid][pKills],
GetPlayerSkin(playerid),
pInfo[playerid][pRobbed],
pInfo[playerid][pRobbedMoney],
pInfo[playerid][pGotRobbed],
pInfo[playerid][pGotRobbedMoney],
pInfo[playerid][pStoreRobbed],
pInfo[playerid][pStoreRobbedMoney],
pInfo[playerid][pFoodPurchased],
pInfo[playerid][pFoodPurchasedMoney],
pInfo[playerid][pWeaponsPurchased],
pInfo[playerid][pWeaponsPurchasedMoney],
pInfo[playerid][pID],
PlayerName(playerid));
mysql_tquery(MySQLCon, query, "", "");
print(query);
mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `IsBanned`=%d WHERE `ID`=%d AND user='%e'", pInfo[playerid][pIsBanned], PlayerName(playerid));
mysql_tquery(MySQLCon, query, "", "");
IsLoggedIn[playerid] = 0;
if(pInfo[playerid][pAdmin] >= 1)
{
mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `AdminName`=%s WHERE `ID`=%d AND `user`='%e'", pInfo[playerid][pAName]);
return true;
}
}
return 1;
}
Something like that:
pawn Код:
|
if(gTeam[playerid] == COPS) teamname = "Cop";
if(gTeam[playerid] == ARMY) teamname = "Army";
if(gTeam[playerid] == FBI) teamname = "FBI";
if(gTeam[playerid] == CIA) teamname = "CIA";
if(gTeam[playerid] == CIVILIANS) teamname = "Civilian";
mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `Team`=%s WHERE `ID`=%d AND user='%e'", teamname, pInfo[playerid][pID], PlayerName(playerid));
mysql_tquery(MySQLCon, query, "", "");
GetPlayerTeamName(playerid)
{
new teamname[24];
if(gTeam[playerid] == COPS) teamname = "Cop";
if(gTeam[playerid] == ARMY) teamname = "Army";
if(gTeam[playerid] == FBI) teamname = "FBI";
if(gTeam[playerid] == CIA) teamname = "CIA";
if(gTeam[playerid] == CIVILIANS) teamname = "Civilian";
new name[24];
format(name, sizeof name, "%s", teamname);
return name;
}
I have tried this. but it messed up. I mean, I'm civilian but it shows me Cop.
|
//// Classes
#define COPS 1 #define CIVILIANS 0 #define CIA 3 #define MEDICS 4 #define ARMY 5 #define FBI 6 |
new teamNames[][] = {
{"Civilan"},
{"Cops"},
{"CIA"},
{"Medics"},
{"Army"},
{"FBI"}
};
#define CIVILIANS 0
#define COPS 1
#define CIA 2
#define MEDICS 3
#define ARMY 4
#define FBI 5