Admin On Duty command help
#1

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
Reply
#2

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
Reply
#3

Thanks man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)