Well, I could do this before. But actually, I want to save team name in mysql.
I'm using like this:
PHP код:
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;
}
}
im just confused what should i add here for get player team name
PHP код:
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;
}