/announce help -
GTA_Rules - 20.03.2009
Код:
if(!strcmp(cmdtext, "/announce", true, 8))
{
new tString[256];
if(cmdtext[9] != 32 || cmdtext[9] == EOS)
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "USAGE: /announce <your announcement>");
}
else
{
SendClientMessageToAll(COLOR_YELLOW,tString);
format(tString,sizeof(tString), "| Announcement: | %s", tString);
SendClientMessageToAll(COLOR_YELLOW,tString);
return 1;
}
}
Hmmm I don't get what's wrong with this. It keeps showing USAGE: /announce <your announcement>, even if I type something like /announce test.
Could somebody check this for me please?
Bye!
EDIT: The forums must hate me, my intendation keeps fucking here, sorry for that!
Re: /announce help -
Think - 20.03.2009
pawn Код:
if(strcmp(cmd, "/announce", true) == 0)
{
new length = strlen(cmdtext);
new idx;
new string[128];
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /announce [TEXT]");
return 1;
}
format(string,sizeof(string), "| Announcement: | %s", result);
SendClientMessageToAll(COLOR_YELLOW,tString);
return 1;
}
Re: /announce help -
GTA_Rules - 20.03.2009
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(156) : error 017: undefined symbol "idx"
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(206) : error 033: array must be indexed (variable "idx")
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(20
: error 022: must be lvalue (non-constant)
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(20
: warning 215: expression has no effect
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(210) : error 033: array must be indexed (variable "-unknown-")
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(212) : error 033: array must be indexed (variable "idx")
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(214) : error 033: array must be indexed (variable "idx")
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(215) : error 022: must be lvalue (non-constant)
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(215) : warning 215: expression has no effect
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(217) : error 033: array must be indexed (variable "idx")
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(223) : error 017: undefined symbol "string"
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(223) : error 017: undefined symbol "string"
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(223) : error 029: invalid expression, assumed zero
C:\Users\Matthias\Desktop\SA-MP Stuff\Servers\Los Santos TDM - Without IRC\gamemodes\LosSantos.pwn(223) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
:<
Re: /announce help -
MenaceX^ - 20.03.2009
You pawn tags.
Under OnPlayerCommandText, above all commands.
Re: /announce help -
GTA_Rules - 20.03.2009
Should I remove that?
Re: /announce help -
Rks25 - 20.03.2009
No add that.
Re: /announce help -
MenaceX^ - 20.03.2009
Quote:
Originally Posted by GTA_Rules
Should I remove that?
|
You can't remove something that doesn't exist..
Re: /announce help -
Nero_3D - 20.03.2009
use that, thats the best
pawn Код:
if(!strcmp(cmdtext, "/announce", true, 9))
{
if(cmdtext[9] != 32 || cmdtext[10] == EOS)
return SendClientMessage(playerid, COLOR_BRIGHTRED, "USAGE: /announce <your announcement>");
new tString[128];
format(tString, sizeof(tString), "| Announcement: | %s", cmdtext[10]);
return SendClientMessageToAll(COLOR_YELLOW, tString);
}
and to your first post, if you dont understand how that works, dont use it!
Re: /announce help -
Zack9764 - 21.03.2009
Код:
if(strcmp(cmd, "/announce", true) == 0 || strcmp(cmd, "/gov", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/gov)ernment [text]");
return 1;
}
SendClientMessageToAll(ColorHere, "-|_________________ Announcement _________________|-");
SendClientMessageToAll(ColorHere, "Message Here");
}
return 1;
}
that should work
Re: /announce help -
Rks25 - 21.03.2009
No zack, that won't work. You need a format().
Else it will send 1 basic message each time i do it.