new Duty[MAX_PLAYER_NAME];
CMD:duty(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 1)return 0;
new Type[12];
new Float:health, Float:skin;
GetPlayerSkin(playerid, skin);
GetPlayerHealth(playerid, health);
if(sscanf(params, "u[50]", ID, Type)) return SCM(playerid, orange, "Go on duty: /duty <on/off>");
if(strcmp(Type, "on", true) == 0)
{
Duty[playerid] = 1;
GetPlayerName(playerid, pName, sizeof(pName));
format(ustr, sizeof(ustr), "%s %s is ON duty.", AdminLevelName(playerid), pName);
SendMessageToAdmins(Lblue, ustr);
SetPlayerSkin(playerid, 217);
SetPlayerHealth(playerid, 100000000);
}
else if(strcmp(Type, "off", true) == 0)
{
Duty[playerid] = 0;
GetPlayerName(playerid, pName, sizeof(pName));
format(ustr, sizeof(ustr), "%s %s is OFF duty.", AdminLevelName(playerid), pName);
SendMessageToAdmins(Lblue, ustr);
SetPlayerHealth(playerid, health);
SetPlayerSkin(playerid, skin);
}
return 1;
}
new LastSkin[MAX_PLAYERS];
LastSkin[playerid] = GetPlayerSkin(playerid);
SetPlayerSkin(playerid, LastSkin[playerid]);
new Duty[MAX_PLAYER_NAME];
CMD:duty(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 1)return 0;
new Type[12];
new LastSkin[MAX_PLAYER_NAME];
LastSkin[playerid] = GetPlayerSkin(playerid);
new Float:health;
GetPlayerHealth(playerid, health);
if(sscanf(params, "u[50]", ID, Type)) return SCM(playerid, orange, "Go on duty: /duty <on/off>");
if(strcmp(Type, "on", true) == 0)
{
Duty[playerid] = 1;
GetPlayerName(playerid, pName, sizeof(pName));
format(ustr, sizeof(ustr), "%s %s is ON duty.", AdminLevelName(playerid), pName);
SendMessageToAdmins(Lblue, ustr);
SetPlayerSkin(playerid, 217);
SetPlayerHealth(playerid, 100000000);
}
else if(strcmp(Type, "off", true) == 0)
{
Duty[playerid] = 0;
GetPlayerName(playerid, pName, sizeof(pName));
format(ustr, sizeof(ustr), "%s %s is OFF duty.", AdminLevelName(playerid), pName);
SendMessageToAdmins(Lblue, ustr);
SetPlayerHealth(playerid, health);
SetPlayerSkin(playerid, LastSkin[playerid]);
}
return 1;
}
I'd recommend actually storing the skin in the administrator's stats(assuming the OnDuty status saves), this way their oldskin won't be lost after logging off. @Schneider |
if(!strcmp(Type, "on", false))
if(!strcmp(Type, "off", false))
if(sscanf(params, "us[5]", ID, Type)) |
if(sscanf(params, "u[50]", ID, Type)) return SCM(playerid, orange, "Go on duty: /duty <on/off>");
if(sscanf(params, "us[50]", ID, Type)) return SCM(playerid, orange, "Go on duty: /duty <on/off>");
false))
Originally Posted by Wiki
ignorecase (optional) When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same.
|
new Duty[MAX_PLAYER_NAME]; CMD:duty(playerid, params[]) { if(pInfo[playerid][Adminlevel] < 1)return 0; new Type[5]; new LastSkin[MAX_PLAYER_NAME]; LastSkin[playerid] = GetPlayerSkin(playerid); new Float:health; GetPlayerHealth(playerid, health); if(sscanf(params, "s[5]", Type)) return SCM(playerid, orange, "Go on duty: /duty <on/off>"); if(!strcmp(Type, "on", false)) { Duty[playerid] = 1; GetPlayerName(playerid, pName, sizeof(pName)); format(ustr, sizeof(ustr), "%s %s is ON duty.", AdminLevelName(playerid), pName); SendMessageToAdmins(Lblue, ustr); SetPlayerSkin(playerid, 217); SetPlayerHealth(playerid, 100000000); } else if(!strcmp(Type, "off", false)) { Duty[playerid] = 0; GetPlayerName(playerid, pName, sizeof(pName)); format(ustr, sizeof(ustr), "%s %s is OFF duty.", AdminLevelName(playerid), pName); SendMessageToAdmins(Lblue, ustr); SetPlayerHealth(playerid, health); SetPlayerSkin(playerid, LastSkin[playerid]); } return 1; }