Save team
#1

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(playeridparams[])
{
    if (
playerData[playerid][pd_AdminRank])
    {
        new 
message[MAX_STRING], playerName[MAX_PLAYER_NAME];
        
GetPlayerName(playeridplayerNamesizeof(playerName));
        if (!
playerData[playerid][pd_IsOnDuty])
        {
            
playerData[playerid][pd_IsOnDuty] = true;
            
format(messagesizeof(message), "[SERVER] %s %s(%i) is now on-duty."GetStaffClassName(playerid), playerNameplayerid);
              
SetPVarInt(playerid"LastSkin"GetPlayerSkin(playerid));
            
GetPlayerHealth(playeridaHealth[playerid]);
              
GetPlayerArmour(playeridaArmour[playerid]);
            for (new 
0i<13i++)
            {
                
GetPlayerWeaponData(playeridipWeapon[playerid][i], pAmmo[playerid][i]);
            }
            
ResetPlayerWeapons(playerid);
            
SetPlayerSkinEx(playeridSKIN_STAFF);
            
SetPlayerTeam(playeridNO_TEAM);
            
SetPlayerColor(playeridCOLOR_ADMIN);
            
SetPlayerHealth(playeridMAX_HEALTH_ADMINISTRATOR);
            
Update3DTextLabelText(t3dRankLabel[playerid], COLOR_ADMIN"Staff");
            
playerData[playerid][pd_TeamId] = NO_TEAM;
            
GivePlayerWeaponEx(playeridWEAPON_MINIGUNMAX_WEAPON_AMMO);
        }
        else
        {
            
playerData[playerid][pd_IsOnDuty] = false;
            
format(messagesizeof(message), "[SERVER] %s %s(%i) is now off-duty."GetStaffClassName(playerid), playerNameplayerid);
               
ResetPlayerWeapons(playerid);
            
SetPlayerSkin(playeridGetPVarInt(playerid"LastSkin"));
            
SetPlayerHealth(playeridaHealth[playerid]);
            
SetPlayerArmour(playeridaArmour[playerid]);
            for(new 
i=0i<13i++)
            {
                
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(playeridSLOT_PAO_HAT19108BONE_HEADgHelmetOffsets[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_SERVERmessage);
    }
    else
    {
        
SendScreenMessage(playeridLOCALE_MESSAGE_NOTAUTHORIZEDCOMMAND);
    }
    
    return 
1;

Reply
#2

PHP код:
// on aduty
SetPVarInt(playerid"my_Team"GetPlayerTeam(playerid));
// off aduty
SetPlayerTeam(playeridGetPVarInt(playerid"my_Team"));
DeletePVar(playerid"my_Team"); 
Reply
#3

Quote:
Originally Posted by JaKe Elite
Посмотреть сообщение
PHP код:
// on aduty
SetPVarInt(playerid"my_Team"GetPlayerTeam(playerid));
// off aduty
SetPlayerTeam(playeridGetPVarInt(playerid"my_Team"));
DeletePVar(playerid"my_Team"); 
I tried that but it didn't work... This is how the teams are set so it should me like this?
PHP код:
    //SetPlayerTeam(playerid, playerData[playerid][pd_TeamId]);
SetPVarInt(playerid"my_Team",playerData[playerid][pd_TeamId] );
// when they going off duty
SetPlayerTeam(playeridGetPVarInt(playerid"Team"));
DeletePVar(playerid"my_Team"); 
Reply
#4

bump
Reply
#5

PHP код:
SetPVarInt(playerid"my_Team",playerData[playerid][pd_TeamId] );
// when they going off duty
SetPlayerTeam(playeridGetPVarInt(playerid"my_Team"));
DeletePVar(playerid"my_Team"); 
Reply
#6

Quote:
Originally Posted by Primes007
Посмотреть сообщение
PHP код:
SetPVarInt(playerid"my_Team",playerData[playerid][pd_TeamId] );
// when they going off duty
SetPlayerTeam(playeridGetPVarInt(playerid"my_Team"));
DeletePVar(playerid"my_Team"); 
didn't work, just want the command to work like this, once a player goes on duty it saves there weapons,health, armour , skin and team, and then the admin comes off duty it restore his/her health,armour,skin,weapons etc... but i don't what im doing wrong in my code
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)