/(an)nounce command. Help please. - 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: /(an)nounce command. Help please. (
/showthread.php?tid=129626)
/(an)nounce command. Help please. -
ownboy - 22.02.2010
Код:
if (strcmp("/an", cmdtext, true, 5) == 0 || strcmp("/announce", cmdtext, true, 5) == 0) // Anounces Text Accross All Players Screens
{
if(PlayerAdminLevel[playerid] >= 2)
{
if(strlen(cmdtext) <= 6) {
SendClientMessage(playerid, COLOR_RED, "USAGE: /(an)nounce (msg)");
return 1;
}
new pName[24], str[128];
new text = strlen(cmdtext)
ERROR LINE>> GetPlayerName(playerid,pName,sizeof(pName)); << ERROR LINE
format(str, sizeof(str), "[ADMIN ANNOUNCE] %s(%d): %s.", pName, playerid, text);
SendClientMessageToAll(COLOR_BLUE, str);
}
else
SendClientMessage(playerid,0xFF0000AA,"Bad Command. Type /commands for available commands depending on your chosen job/skill");
return 1;
}
Код:
C:\Users\Bouke\Desktop\Server\Server 1\gamemodes\lvrcr.pwn(5545) : error 001: expected token: ";", but found "-identifier-"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: /(an)nounce command. Help please. -
Fedee! - 22.02.2010
pawn Код:
if (strcmp("/an", cmdtext, true, 5) == 0 || strcmp("/announce", cmdtext, true, 5) == 0) // Anounces Text Accross All Players Screens
{
if(PlayerAdminLevel[playerid] >= 2)
{
if(strlen(cmdtext) <= 6) {
SendClientMessage(playerid, COLOR_RED, "USAGE: /(an)nounce (msg)");
return 1;
}
new pName[24], str[128];
new text = strlen(cmdtext);//You forgot a ;
GetPlayerName(playerid,pName,sizeof(pName));
format(str, sizeof(str), "[ADMIN ANNOUNCE] %s(%d): %s.", pName, playerid, text);
SendClientMessageToAll(COLOR_BLUE, str);
}
else
SendClientMessage(playerid,0xFF0000AA,"Bad Command. Type /commands for available commands depending on your chosen job/skill");
return 1;
}
Re: /(an)nounce command. Help please. -
silvan - 22.02.2010
check the line before that line, it got " ; " missing
Re: /(an)nounce command. Help please. -
ownboy - 22.02.2010
Compile worked. But when im ingame. I do /an then i see USEAGE: /an (Message) when I do /an Hello. Then it said Bad Command. Help??
Re: /(an)nounce command. Help please. -
CJ101 - 22.02.2010
Use dcmd, its faster.
pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
pawn Код:
dcmd_an(playerid,params[]) {
if(!IsPlayerAdmin(playerid)) return 0;
if(!strlen(params)) return SendClientMessage(playerid,0xFF0000AA,"USAGE: /an <text>");
return GameTextForAll(params,4000,3);
}
Under OnPlayerCommandText:
Re: /(an)nounce command. Help please. -
Sfrcr - 22.07.2010
try if(PlayerAdminLevel[playerid] >= 2);
or new text = strlen(cmdtext);