/adminduty - QUICK HELP -
PabloDiCostanzo - 26.02.2013
Greetings,
I have this script, I made this in my GM but now I want to when someone (admin) use /adminduty, it change the player color to COLOR_CYAN
Regards,
Pablo
pawn Код:
CMD:adminduty(playerid, params[])
{
new str[126];
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You are not authorized to use this command.");
if(GetPVarInt(playerid, "Injured") == 1) return SendClientMessage(playerid, COLOR_GREY, "WARNING: You may not go on duty while injured, /giveup if emergency.");
if(AdminDuty[playerid] != 1)
{
AdminDutyCash[playerid] = PlayerInfo[playerid][pCash];
GetPlayerHealth(playerid, AdminDutyHealth[playerid]);
AdminDutyArmor[playerid] = PlayerInfo[playerid][pArmor];
AdminDuty[playerid] = 1;
format(str, sizeof(str), "%s (ID %i - %s) is now on duty as a level %i admin.", PlayerInfo[playerid][pAName], playerid, GetName(playerid), PlayerInfo[playerid][pAdmin]);
SendClientMessageToAdmins(-1, str, 1);
SetPlayerName(playerid, PlayerInfo[playerid][pAName]);
SendClientMessage(playerid, -1, "STAFF: You are now on duty as an admin, you do now have access to all of your commands.");
GetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
}
else
{
waitcheck[playerid] = 2;
SetPVarInt(playerid, "SpecOff", 1);
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(playerid);
AdminDuty[playerid] = 0;
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ], 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerWeapons(playerid);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
SetPlayerName(playerid, PlayerInfo[playerid][pName]);
new backup[126];
format(backup, 126, "%s Old cash: %i - New cash: %i", GetName(playerid), PlayerInfo[playerid][pCash], AdminDutyCash[playerid]);
Log("/logs/backup.txt", backup);
PlayerInfo[playerid][pCash] = AdminDutyCash[playerid];
SetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
format(str, sizeof(str), "%s (ID %i - %s) is now off admin duty.", PlayerInfo[playerid][pAName], playerid, GetName(playerid));
SendClientMessageToAdmins(-1, str, 1);
SendClientMessage(playerid, -1, "STAFF: You are now off duty as an admin and have only a limited access to your commands.");
spec[playerid] = -1;
SetPlayerWeaponsEx(playerid);
}
return 1;
}
P.S: This command work.
Re: /adminduty -
Mitchy - 26.02.2013
Alright, here's my version:
Код:
command(aduty, playerid, params[])
{
if(Player[playerid][AdminLevel] >= 1)
{
if(isnull(params)) return SendClientMessage(playerid, WHITE, "Server: /aduty [on/off]");
{
new string[256];
if(strmatch("on", params))
{
if(aDuty[playerid] == 0)
{
aDuty[playerid] = 1;
format(string, sizeof(string), "AdmMsg: Admin %s is now on Admin Duty.", RemoveUnderScore(playerid));
SendToAdmins(RED, string, 1);
SendToAdmins(RED, string, 0);
SetPlayerColor(playerid, ADUTY);
}
else return SendClientMessage(playerid, WHITE, "You are already on Admin Duty.");
}
else if(strmatch("off", params))
{
if(aDuty[playerid] == 1)
{
aDuty[playerid] = 0;
format(string, sizeof(string), "AdmMsg: Admin %s in now off Admin Duty.", RemoveUnderScore(playerid));
SendToAdmins(RED, string, 1);
SendToAdmins(RED, string, 0);
SetPlayerColor(playerid, TRANSPARENT);
}
else return SendClientMessage(playerid, WHITE, "You are already off Admin Duty.");
}
}
}
else return SendClientMessage(playerid, GREY, AdminOnly);
return 1;
}
Edit it to your likings if you want health, make a setplayerhealth, if you want a color change it from TRANSPARENT to "color here"
Simple
Re: /adminduty -
seanny - 26.02.2013
Look for any SetPlayerColor functions in your script.
Re: /adminduty -
Oscii - 26.02.2013
SetPlayerColor(playerid, COLOR_CYAN);
add that under the line: SendToAdmins(RED, string, 0);
Re: /adminduty -
PabloDiCostanzo - 27.02.2013
Okay, Iґll try.
Re: /adminduty -
PabloDiCostanzo - 28.02.2013
Here is not "SendToAdmin"
pawn Код:
CMD:adminduty(playerid, params[])
{
new str[126];
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You are not authorized to use this command.");
if(GetPVarInt(playerid, "Injured") == 1) return SendClientMessage(playerid, COLOR_GREY, "WARNING: You may not go on duty while injured, /giveup if emergency.");
if(AdminDuty[playerid] != 1)
{
AdminDutyCash[playerid] = PlayerInfo[playerid][pCash];
GetPlayerHealth(playerid, AdminDutyHealth[playerid]);
AdminDutyArmor[playerid] = PlayerInfo[playerid][pArmor];
AdminDuty[playerid] = 1;
format(str, sizeof(str), "%s (ID %i - %s) is now on duty as a level %i admin.", PlayerInfo[playerid][pAName], playerid, GetName(playerid), PlayerInfo[playerid][pAdmin]);
SendClientMessageToAdmins(-1, str, 1);
SetPlayerName(playerid, PlayerInfo[playerid][pAName]);
SendClientMessage(playerid, -1, "STAFF: You are now on duty as an admin, you do now have access to all of your commands.");
GetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
}
else
{
waitcheck[playerid] = 2;
SetPVarInt(playerid, "SpecOff", 1);
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(playerid);
AdminDuty[playerid] = 0;
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ], 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerWeapons(playerid);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
SetPlayerName(playerid, PlayerInfo[playerid][pName]);
new backup[126];
format(backup, 126, "%s Old cash: %i - New cash: %i", GetName(playerid), PlayerInfo[playerid][pCash], AdminDutyCash[playerid]);
Log("/logs/backup.txt", backup);
PlayerInfo[playerid][pCash] = AdminDutyCash[playerid];
SetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
format(str, sizeof(str), "%s (ID %i - %s) is now off admin duty.", PlayerInfo[playerid][pAName], playerid, GetName(playerid));
SendClientMessageToAdmins(-1, str, 1);
SendClientMessage(playerid, -1, "STAFF: You are now off duty as an admin and have only a limited access to your commands.");
spec[playerid] = -1;
SetPlayerWeaponsEx(playerid);
}
return 1;
}
Respuesta: /adminduty -
Strier - 28.02.2013
Do you have the stock that sends that message to the admins?
Re: /adminduty -
PabloDiCostanzo - 28.02.2013
No, I donґt have
Re: /adminduty -
Denying - 28.02.2013
SetPlayerColor?
Re: /adminduty -
Height - 28.02.2013
Try this code, it should work
pawn Код:
CMD:adminduty(playerid, params[])
{
new str[126];
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You are not authorized to use this command.");
if(GetPVarInt(playerid, "Injured") == 1) return SendClientMessage(playerid, COLOR_GREY, "WARNING: You may not go on duty while injured, /giveup if emergency.");
if(AdminDuty[playerid] != 1)
{
AdminDutyCash[playerid] = PlayerInfo[playerid][pCash];
GetPlayerHealth(playerid, AdminDutyHealth[playerid]);
SetPlayerColor(playerid, 0xFF00FFFF); // Setting player color to cyan
AdminDutyArmor[playerid] = PlayerInfo[playerid][pArmor];
AdminDuty[playerid] = 1;
format(str, sizeof(str), "%s (ID %i - %s) is now on duty as a level %i admin.", PlayerInfo[playerid][pAName], playerid, GetName(playerid), PlayerInfo[playerid][pAdmin]);
SendClientMessageToAdmins(-1, str, 1);
SetPlayerName(playerid, PlayerInfo[playerid][pAName]);
SendClientMessage(playerid, -1, "STAFF: You are now on duty as an admin, you do now have access to all of your commands.");
GetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
}
else
{
waitcheck[playerid] = 2;
SetPVarInt(playerid, "SpecOff", 1);
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(playerid);
AdminDuty[playerid] = 0;
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ], 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerWeapons(playerid);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
SetPlayerName(playerid, PlayerInfo[playerid][pName]);
new backup[126];
format(backup, 126, "%s Old cash: %i - New cash: %i", GetName(playerid), PlayerInfo[playerid][pCash], AdminDutyCash[playerid]);
Log("/logs/backup.txt", backup);
PlayerInfo[playerid][pCash] = AdminDutyCash[playerid];
SetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
format(str, sizeof(str), "%s (ID %i - %s) is now off admin duty.", PlayerInfo[playerid][pAName], playerid, GetName(playerid));
SendClientMessageToAdmins(-1, str, 1);
SetPlayerColor(playerid, 0xC0C0C0FF); // Setting player color back to grey
SendClientMessage(playerid, -1, "STAFF: You are now off duty as an admin and have only a limited access to your commands.");
spec[playerid] = -1;
SetPlayerWeaponsEx(playerid);
}
return 1;
}