SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 12/01/2011, 03:12 PM   #1
darkknight123
Big Clucker
 
Join Date: Jan 2011
Posts: 141
Reputation: 0
Default Admin On Duty command help

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
darkknight123 is offline  
Old 12/01/2011, 03:20 PM   #2
Nonameman
Huge Clucker
 
Nonameman's Avatar
 
Join Date: Jun 2009
Location: Hungary
Posts: 319
Reputation: 18
Default Re: Admin On Duty command help

Quote:
Originally Posted by darkknight123 View Post
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:
Code:
SendClientMessageToAll(0x33CCFFAA," %s Is now a off duty Admin");
If you wanna get a player's name in string, use it with 'format':
pawn Code:
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 Code:
#define your_color 0x33CCFFAA

Hope I could help you
Nonameman is offline  
Old 12/01/2011, 03:59 PM   #3
darkknight123
Big Clucker
 
Join Date: Jan 2011
Posts: 141
Reputation: 0
Default Re: Admin On Duty command help

Thanks man
darkknight123 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Admin on~off duty Johny_James Help Archive 26 31/07/2010 04:06 PM
Admin Duty Help James124 Help Archive 1 17/07/2010 02:11 PM
Need an ''Admin duty'' Fay-Tony Help Archive 7 26/06/2009 06:25 AM
Admin On Duty style100 Help Archive 3 14/03/2009 11:44 AM


All times are GMT. The time now is 02:12 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.