/a(adminchat) 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: /a(adminchat) problem (
/showthread.php?tid=308532)
/a(adminchat) problem -
geerdinho8 - 03.01.2012
I want to make an adminchat, but i can't get it finished, i want to send the client message to all admins but i don't have an idea to do that.
Im so far:
pawn Код:
if(strcmp(cmd, "/a", true) == 0)
{
if(pInfo[playerid][Admin] >= 0)
{
tmp = strtok(cmdtext,idx), tmp2 = strtok(cmdtext,idx);
new player1, level;
player1 = strval(tmp);
level = strval(tmp2);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /a [text]");
}
else
{
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
format(string,sizeof(string),"Adminchat (%s): %s", playername, tmp);
SendClientMessage(playerid, purple, string);
}
}
return 1;
}
Re: /a(adminchat) problem -
coole210 - 03.01.2012
1) You're checking if the player's admin level is equal to or over ZERO (0)
2) You aren't sending message to anybody but yourself
3) You're getting the name of player1 for some reason
4) You have a variable called player1 and level for some reason
5) Holy crap this is so wrong
Sorry, but you need to read EVERYTHING in
https://sampwiki.blast.hk/
pawn Код:
if(strcmp(cmd, "/a", true) == 0)
{
if(pInfo[playerid][Admin] < 1) return 0;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /a [text]");
GetPlayerName(playerid, adminname, sizeof(adminname));
for(new i,ii = GetMaxPlayers(); i < ii; i++)
{
if(IsPlayerConnected(i))
{
if(pInfo[i][Admin] >= 1)
{
format(string,sizeof(string),"Adminchat (%s): %s", playername, tmp);
SendClientMessage(i, purple, string);
}
}
}
return 1;
}