SA-MP Forums Archive
How to make this work properly - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make this work properly (/showthread.php?tid=400158)



How to make this work properly - NinjaChicken - 17.12.2012

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


Re: How to make this work properly - Devilxz97 - 17.12.2012

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 :\


Re: How to make this work properly - Djole1337 - 17.12.2012

never mind


Re: How to make this work properly - NinjaChicken - 17.12.2012

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


Re: How to make this work properly - Devilxz97 - 17.12.2012

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 ? :\


Re: How to make this work properly - YoYo123 - 17.12.2012

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;
}