SA-MP Forums Archive
Admin On Duty command help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Admin On Duty command help (/showthread.php?tid=210178)



Admin On Duty command help - darkknight123 - 12.01.2011

im trying to script a /aod command Amin On Duty this is what i got
Quote:

dcmd_aod(playerid,params[])
{
#pragma unused params
if(AccInfo[playerid][Level] >= 1 || IsPlayerAdmin(playerid))
{
if(AccInfo[playerid][God] == 0)
{
AccInfo[playerid][God] = 1;
SetPlayerHealth(playerid,100000);
GivePlayerWeapon(playerid,16,50000);
GivePlayerWeapon(playerid,38,50000);
SendClientMessage(playerid,green,"|- Admin On Duty -|");
SendClientMessageToAll(0x33CCFFAA," %s Is now a on duty Admin!");
SetPlayerColor(playerid,0x33CCFFAA);
return SendCommandToAdmins(playerid,"aod");
}
else
{
AccInfo[playerid][God] = 0;
SendClientMessage(playerid,red,"|- Admin Off Duty -|");
SendClientMessageToAll(0x33CCFFAA," %s Is now a off duty Admin");
SetPlayerColor(playerid,0xFFFFFFAA);
SetPlayerHealth(playerid, 100);
}
return GivePlayerWeapon(playerid,35,0);
}
else return ErrorMessages(playerid, 6);
}

it complies fine but when i get in game and test it the server crashes :/ i think its because of the sendclientmessage toall because im wanting to to say the players name witch is %s but server crahes IDK what i did wrong please help


Re: Admin On Duty command help - Nonameman - 12.01.2011

Quote:
Originally Posted by darkknight123
Посмотреть сообщение
im trying to script a /aod command Amin On Duty this is what i got

it complies fine but when i get in game and test it the server crashes :/ i think its because of the sendclientmessage toall because im wanting to to say the players name witch is %s but server crahes IDK what i did wrong please help
This won't work:
Код:
SendClientMessageToAll(0x33CCFFAA," %s Is now a off duty Admin");
If you wanna get a player's name in string, use it with 'format':
pawn Код:
new string[64], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), " %s Is now a off duty Admin", name);
SendClientMessageToAll(0x33CCFFAA, string);
And 1 more thing: use colors in defined form, easier to use them:
pawn Код:
#define your_color 0x33CCFFAA
Hope I could help you


Re: Admin On Duty command help - darkknight123 - 12.01.2011

Thanks man