How to make this work properly
#1

pawn Код:
CMD:aduty(playerid, params[]) {
    new string[128];
    if((PlayerInfo[playerid][pAdmin] >= 2) && GetPVarInt(playerid, "IsInArena") < 0 && !GetPVarInt(playerid, "EventToken")) {
        if(PlayerInfo[playerid][pAdminDuty]) {
            PlayerInfo[playerid][pAdminDuty] = 0;
            PlayerInfo[playerid][pTogReports] = 1;
            //SetPlayerToTeamColor(playerid);
            SendClientMessageEx(playerid, COLOR_WHITE, "You have clocked out from Admin Duty, you are now in Role Play Mode.");
            format(string, sizeof(string), "{AA3333}Admin Duty{FFFF00}: %s has clocked off and is now off duty.", GetPlayerNameEx(playerid));
            SetPlayerSkin(playerid, [pModel]);
            ABroadCast(COLOR_YELLOW,string, 2);
            SetPlayerHealth(playerid, 100);
            SetPlayerArmour(playerid, 100);
            SetPlayerColor(playerid, COLOR_WHITE);
            new string[128];
            format(string, sizeof(string), "{FFFFFF}Administrator %s is {FF0000}[OFF] {FFFFFF}admin duty, Do not report for this admin allow him/her to role-play", GetPlayerNameEx(playerid));
            SendClientMessageToAllEx(COLOR_WHITE, string);
        }
        else {
            PlayerInfo[playerid][pAdminDuty] = 1;
            PlayerInfo[playerid][pTogReports] = 0;
            //SetPlayerToTeamColor(playerid);
            SendClientMessageEx(playerid, COLOR_WHITE, "You have clocked in to Admin Duty, you are no longer in Role play Mode.");
            format(string, sizeof(string), "{AA3333}Admin Duty{FFFF00}: %s has clocked in and is now on duty.", GetPlayerNameEx(playerid));
            ABroadCast(COLOR_YELLOW,string, 2);
            SetPlayerHealth(playerid, 100000);
            SetPlayerArmour(playerid, 100000);
            SetPlayerColor(playerid, COLOR_BLACK);
            SetPlayerSkin(playerid, 217);
            new string[128];
            format(string, sizeof(string), "{FFFFFF}Administrator %s is {25FF00}[ON] {FFFFFF}admin duty, he/she is now accepting /reports.", GetPlayerNameEx(playerid));
            SendClientMessageToAllEx(COLOR_WHITE, string);
        }
    }
    return 1;
}
what i want it to do is i /aduty and then it sets my skin to the admin skin but when i /aduty again it sets it back to the skin i had before i typed the cmd please help
Reply
#2

u want when u type /aduty cmd again it will set ur skin that u use b4 using the cmd or what ? O.O cant understand u :\
Reply
#3

never mind
Reply
#4

urgh when a player logs in his skin is loaded due to it being saved then he type /aduty and it changes to the admin skin but after he types it again it changes back to the one what is saved
Reply
#5

so, when player type /aduty cmd again , u dont want the player skin back to the saved one ? u want it to be the admin skin when u do /aduty ? like that ? the admin skin ? :\
Reply
#6

Make a new variable at the top:
pawn Код:
new LastSkin[MAX_PLAYERS];
And copy this code to your command:
pawn Код:
CMD:aduty(playerid, params[]) {
    new string[128];
    if((PlayerInfo[playerid][pAdmin] >= 2) && GetPVarInt(playerid, "IsInArena") < 0 && !GetPVarInt(playerid, "EventToken")) {
        if(PlayerInfo[playerid][pAdminDuty]) {
            PlayerInfo[playerid][pAdminDuty] = 0;
            PlayerInfo[playerid][pTogReports] = 1;
            //SetPlayerToTeamColor(playerid);
            SendClientMessageEx(playerid, COLOR_WHITE, "You have clocked out from Admin Duty, you are now in Role Play Mode.");
            format(string, sizeof(string), "{AA3333}Admin Duty{FFFF00}: %s has clocked off and is now off duty.", GetPlayerNameEx(playerid));
            LastSkin[playerid] = GetPlayerSkin(playerid);
            SetPlayerSkin(playerid, 294);
            ABroadCast(COLOR_YELLOW,string, 2);
            SetPlayerHealth(playerid, 100);
            SetPlayerArmour(playerid, 100);
            SetPlayerColor(playerid, COLOR_WHITE);
            new string[128];
            format(string, sizeof(string), "{FFFFFF}Administrator %s is {FF0000}[OFF] {FFFFFF}admin duty, Do not report for this admin allow him/her to role-play", GetPlayerNameEx(playerid));
            SendClientMessageToAllEx(COLOR_WHITE, string);
        }
        else {
            PlayerInfo[playerid][pAdminDuty] = 1;
            PlayerInfo[playerid][pTogReports] = 0;
            //SetPlayerToTeamColor(playerid);
            SendClientMessageEx(playerid, COLOR_WHITE, "You have clocked in to Admin Duty, you are no longer in Role play Mode.");
            format(string, sizeof(string), "{AA3333}Admin Duty{FFFF00}: %s has clocked in and is now on duty.", GetPlayerNameEx(playerid));
            ABroadCast(COLOR_YELLOW,string, 2);
            SetPlayerHealth(playerid, 100000);
            SetPlayerArmour(playerid, 100000);
            SetPlayerColor(playerid, COLOR_BLACK);
            SetPlayerSkin(playerid, LastSkin[playerid]);
            new string[128];
            format(string, sizeof(string), "{FFFFFF}Administrator %s is {25FF00}[ON] {FFFFFF}admin duty, he/she is now accepting /reports.", GetPlayerNameEx(playerid));
            SendClientMessageToAllEx(COLOR_WHITE, string);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)