Need help with a command - 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: Need help with a command (
/showthread.php?tid=95908)
Need help with a command -
Hiitch - 05.09.2009
Hi Guys, it's me again, I am having this problem with making an admin command work. It is called /ac, What it is is just an admin chat, for admins to talk with eachother, but my problem that I have is that, if a non-admin types /ac <message>, he doesnt talk in it,because it returns 0;. but if an admin types /ac <message> the non-admins see it, as well as the admins. Is there any way to fix it?
pawn Код:
if(strcmp(cmdtext, "/ac", true, 3)==0) if(Logged[playerid] == 1)
{
if(!GetPlayerAdminz(playerid)) return 0;
{
if(!strlen(cmdtext[4])) return SendClientMessage(playerid, 0xFF0000AA, "[ ! ] USAGE: /ac [message]");
}
new playaname[MAX_PLAYER_NAME];
GetPlayerName(playerid,playaname,sizeof(playaname));
for(new i; i<MAX_PLAYERS; i++){
format(string, 128, "Admin lvl.%i %s : %s",GetPlayerAdminz(i), playaname, cmdtext[4]);
if(IsPlayerConnected(i) && GetPlayerAdminz(i)){ // Is the other admins connected ? Are they admins ?
}
SendClientMessage(i, 0xFF0000FF, string);
}
return 1;
}
GetPlayerAdmin / ResetPlayerAdmin / GivePlayerAdmin stocks
pawn Код:
// =============================================================================
stock ResetPlayerAdminz(playerid)
{
Adminz[playerid] = 0;
return Adminz[playerid];
}
// =============================================================================
stock GetPlayerAdminz(playerid)
{
return Adminz[playerid];
}
// =============================================================================
stock GivePlayerAdminz(playerid,lvl)
{
Adminz[playerid] = Adminz[playerid] + lvl;
return Adminz[playerid];
}
// =============================================================================
Any help would be appreciated !