27.12.2017, 05:53
How can i temperarily save a team, in otherwords i made this aduty command and i want to save the admin team and color and then restore it once he/she uses and /aduty command again and goes off duty...
PHP код:
CMD:adminduty(playerid, params[])
{
if (playerData[playerid][pd_AdminRank])
{
new message[MAX_STRING], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, sizeof(playerName));
if (!playerData[playerid][pd_IsOnDuty])
{
playerData[playerid][pd_IsOnDuty] = true;
format(message, sizeof(message), "[SERVER] %s %s(%i) is now on-duty.", GetStaffClassName(playerid), playerName, playerid);
SetPVarInt(playerid, "LastSkin", GetPlayerSkin(playerid));
GetPlayerHealth(playerid, aHealth[playerid]);
GetPlayerArmour(playerid, aArmour[playerid]);
for (new i = 0; i<13; i++)
{
GetPlayerWeaponData(playerid, i, pWeapon[playerid][i], pAmmo[playerid][i]);
}
ResetPlayerWeapons(playerid);
SetPlayerSkinEx(playerid, SKIN_STAFF);
SetPlayerTeam(playerid, NO_TEAM);
SetPlayerColor(playerid, COLOR_ADMIN);
SetPlayerHealth(playerid, MAX_HEALTH_ADMINISTRATOR);
Update3DTextLabelText(t3dRankLabel[playerid], COLOR_ADMIN, "Staff");
playerData[playerid][pd_TeamId] = NO_TEAM;
GivePlayerWeaponEx(playerid, WEAPON_MINIGUN, MAX_WEAPON_AMMO);
}
else
{
playerData[playerid][pd_IsOnDuty] = false;
format(message, sizeof(message), "[SERVER] %s %s(%i) is now off-duty.", GetStaffClassName(playerid), playerName, playerid);
ResetPlayerWeapons(playerid);
SetPlayerSkin(playerid, GetPVarInt(playerid, "LastSkin"));
SetPlayerHealth(playerid, aHealth[playerid]);
SetPlayerArmour(playerid, aArmour[playerid]);
for(new i=0; i<13; i++)
{
GivePlayerWeaponEx(playerid,pWeapon[playerid][i],pAmmo[playerid][i]);
}
// ForceClassSelection(playerid);
// SetPlayerHealth(playerid, 0.0);
// playerData[playerid][pd_Deaths] --;
// FirstSpawn[playerid] = 1;
}
if (pHasHelmet[playerid])
{
new const SKIN_ID = GetPlayerSkin(playerid);
SetPlayerAttachedObject(playerid, SLOT_PAO_HAT, 19108, BONE_HEAD, gHelmetOffsets[SKIN_ID][0], gHelmetOffsets[SKIN_ID][1], gHelmetOffsets[SKIN_ID][2], gHelmetOffsets[SKIN_ID][3], gHelmetOffsets[SKIN_ID][4], gHelmetOffsets[SKIN_ID][5], gHelmetOffsets[SKIN_ID][6], gHelmetOffsets[SKIN_ID][7], gHelmetOffsets[SKIN_ID][8]);
}
SendClientMessageToAll(COLOR_SERVER, message);
}
else
{
SendScreenMessage(playerid, LOCALE_MESSAGE_NOTAUTHORIZEDCOMMAND);
}
return 1;
}