Command problem - 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: Command problem (
/showthread.php?tid=559053)
Command problem -
Thoma - 20.01.2015
I made 2 admin Commands and they work...BUT when the admin goes onduty they dont change to the color ID as the are set to...any ideas why?
Code:
Код:
COMMAND:onduty(playerid,params[])
{
if(pInfo[playerid][Adminlevel] >= 1)
{
SetPlayerHealth(playerid,99999);
SetPlayerArmour(playerid,99999);
SetPlayerColor(playerid,COLOR_RED);
GivePlayerWeapon(playerid,38,99999);
SendClientMessageToAll(COLOR_RED,"A ADMIN is now on DUTY! The ADMIN is defined as a RED player.");
}
return 1;
}
COMMAND:offduty(playerid,params[])
{
if(pInfo[playerid][Adminlevel] >= 1)
{
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
SetPlayerColor(playerid,COLOR_WHITE);
SendClientMessageToAll(COLOR_RED,"The ADMIN is now OFF-DUTY.");
}
return 1;
}
Re: Command problem -
TFreemen - 20.01.2015
Код:
SetPlayerColor(playerid, 0xAA3333AA);
?
Re: Command problem -
HY - 20.01.2015
At the top of script:
pawn Код:
new bool:OnDuty[MAX_PLAYERS];
An single command:
pawn Код:
CMD:duty(playerid, params[])
{
new name[MAX_PLAYER_NAME], string[144];
GetPlayerName(playerid, name, sizeof(name));
if(pInfo[playerid][Adminlevel] >= 1)
{
if(OnDuty[playerid] == false)
{
SetPlayerHealth(playerid,99999);
SetPlayerArmour(playerid,99999);
SetPlayerColor(playerid, 0xFF0000FF);
GivePlayerWeapon(playerid,38,99999);
SendClientMessageToAll(COLOR_RED,"Administrator %s it's now On-Duty.");
OnDuty[playerid] = true;
}
else if(OnDuty[playerid] == true)
{
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
SetPlayerColor(playerid, 0xFFFFFFFF);
SendClientMessageToAll(COLOR_RED,"Administrator %s it's now Off-Duty.");
OnDuty[playerid] = false;
}
}
else
{
SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You aren't authorized to use this command.");
}
return 1;
}
Re: Command problem -
Thoma - 20.01.2015
Thanks HY after 24 hours i will rep ya :P
Re: Command problem -
Thoma - 20.01.2015
Yea scratch that ^^ um now when we do the duty command the server closes....how do I fix that?
Re: Command problem -
Schneider - 20.01.2015
Thatґs because HY has no idea what he is doing...
pawn Код:
CMD:duty(playerid, params[])
{
new name[MAX_PLAYER_NAME], string[64];
GetPlayerName(playerid, name, sizeof(name));
if(pInfo[playerid][Adminlevel] >= 1)
{
if(OnDuty[playerid] == false)
{
SetPlayerHealth(playerid,99999);
SetPlayerArmour(playerid,99999);
SetPlayerColor(playerid, 0xFF0000FF);
GivePlayerWeapon(playerid,38,99999);
format(string, sizeof(string), "Administrator %s is now On-Duty.", name);
SendClientMessageToAll(COLOR_RED, string);
OnDuty[playerid] = true;
}
else if(OnDuty[playerid] == true)
{
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
SetPlayerColor(playerid, 0xFFFFFFFF);
format(string, sizeof(string), "Administrator %s is now Off-Duty.", name);
SendClientMessageToAll(COLOR_RED, string);
OnDuty[playerid] = false;
}
}
else
{
SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You aren't authorized to use this command.");
}
return 1;
}
Re: Command problem -
Thoma - 20.01.2015
lol Thanks will try it now
Re: Command problem -
Thoma - 20.01.2015
yours worked :P thanks