[SOLVED! DELETE!] Chat Commands Interfering -
[HIR]AlbanianSoilder - 22.12.2010
So i have two chat commands and they interfear.
The first command is /t
and the other is /tt
when i type /t and the message example:
/t test -> (LOCAL) Player said test.
and it works with it, but when i use /tt i get this example:
/tt test -> (LOCAL) Player said t test.
it is supposed to say (LOCAL-TELE) Player said test
Help! Please
here are the commands....
Код:
if (strcmp("/t", cmdtext, true, 2) == 0)
{
if(TEAMS)
{
if(strlen(cmdtext) <= 3)
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /t (Text)");
return 1;
}
new output[255];
strmid(output,cmdtext,2,strlen(cmdtext));
for(new i=0;i<MAX_PLAYERS;i++)
{
if() // All the teams
{
format(string, sizeof(string), "(LOCAL) %s said %s.", playername, output);
SendClientMessage(i, COLOR_ORANGE, string);
}
}
return 1;
}
else
{
// can't use command message
}
return 1;
}
if (strcmp("/tt", cmdtext, true, 2) == 0)
{
if(TEAMS)
{
if(strlen(cmdtext) <= 3)
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /tt (Text)");
return 1;
}
new output[255];
strmid(output,cmdtext,2,strlen(cmdtext));
for(new i=0;i<MAX_PLAYERS;i++)
{
if() // All the teams
{
format(string, sizeof(string), "(LOCAL-TELE) %s said %s.", playername, output);
SendClientMessage(i, COLOR_WHITE, string);
}
}
return 1;
}
else
{
// can't use command message
}
return 1;
}
Re: Chat Commands Interfering -
iFriSki - 22.12.2010
Not promising anything, as I don't use strcmp anymore, but..
pawn Код:
if (strcmp("/t", cmdtext, true, 2) == 0)
{
if(TEAMS)
{
if(strlen(cmdtext) <= 3)
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /t (Text)");
return 1;
}
new output[255];
strmid(output,cmdtext,2,strlen(cmdtext));
for(new i=0;i<MAX_PLAYERS;i++)
{
if() // All the teams
{
format(string, sizeof(string), "(LOCAL) %s said %s.", playername, output);
SendClientMessage(i, COLOR_ORANGE, string);
}
}
return 1;
}
else
{
// can't use command message
}
return 1;
}
if (strcmp("/tt", cmdtext, true, 3) == 0)
{
if(TEAMS)
{
if(strlen(cmdtext) <= 3)
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /tt (Text)");
return 1;
}
new output[255];
strmid(output,cmdtext,2,strlen(cmdtext));
for(new i=0;i<MAX_PLAYERS;i++)
{
if() // All the teams
{
format(string, sizeof(string), "(LOCAL-TELE) %s said %s.", playername, output);
SendClientMessage(i, COLOR_WHITE, string);
}
}
return 1;
}
else
{
// can't use command message
}
return 1;
}
[pawn][/pawn] for your code tags.
Re: Chat Commands Interfering -
Krx17 - 22.12.2010
Look at when you split the string. In the /tt command, your splitting it in between the two t's.
pawn Код:
//Fixed
strmid(output,cmdtext,3,strlen(cmdtext));
Re: Chat Commands Interfering -
[HIR]AlbanianSoilder - 22.12.2010
iFriSki - Thanks for the help attempt really i appreciate it, but that didn't work.
Krx17 - That was the problem, i was stupid enough not to notice it, thank you very much.
SAMP community, sorry for taking time out of your guys scripting, i really appreciate it!
THANKS!
**Admin, you may delete this topic.**