Error with /Announce CMD - 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: Error with /Announce CMD (
/showthread.php?tid=254688)
Error with /Announce CMD -
orrgoren11 - 12.05.2011
Hi everyone,
When I type the /announce command, and after that a message, it shows only until the first space, and that's it.
here is the Code:
Код:
if(strcmp(cmd, "/announce", true) == 0 || strcmp(cmd, "/ann", true) == 0)
{
if(PlayerInfo[playerid][pAdminLevel] >= gCommands[ANNOUNCE])
{
new tmp[256], string[150];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){ return SendClientMessage(playerid, COLOR_LIGHTCYAN, "./announce | /ann [txt]"); }
format( string, sizeof(string), "~g~%s", tmp);
GameTextForAll(string, 5000, 5);
}
return 1;
}
Thank you very much!
Re: Error with /Announce CMD -
orrgoren11 - 12.05.2011
Anyone ?
Re: Error with /Announce CMD -
Daddy Yankee - 12.05.2011
Код:
if(strcmp(cmd, "/announce", true) == 0 || strcmp(cmd, "/ann", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdminLevel] >= gCommands[ANNOUNCE])
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[96];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_LIGHTCYAN, "./announce | /ann [txt]");
return 1;
}
format(string, sizeof(string), "~g~%s",result);
GameTextForAll(string, 5000, 5);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
return 1;
}
}
return 1;
}