Radio with space? - 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: Radio with space? (
/showthread.php?tid=187128)
Radio with space? -
Mean - 01.11.2010
pawn Код:
if(!strcmp(cmdtext, "/r", true, 2))
{
new string[128], Player[MAX_PLAYER_NAME];
GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
format(string, 128, "RADIO: %s: %s", Player, cmdtext[2]);
for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i]==gTeam[playerid]) SendClientMessage(i, COLOR_GREEN, string);
return 1;
}
now when I type /rules it says
RADIO: Mean: ules
how can I make it so it needs to put space not like /rhelp me I want it /r help me
Re: Radio with space? -
Voldemort - 01.11.2010
Explain more
Re: Radio with space? -
Jeffry - 01.11.2010
Maybe:
pawn Код:
if(!strcmp(cmdtext, "/r ", true, 3))
{
new string[128], Player[MAX_PLAYER_NAME];
GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
format(string, 128, "RADIO: %s: %s", Player, cmdtext[3]);
for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i]==gTeam[playerid]) SendClientMessage(i, COLOR_GREEN, string);
return 1;
}
Try it. ^^
Re: Radio with space? -
Mean - 03.11.2010
Doesnt work
Re: Radio with space? -
Bessensap - 03.11.2010
pawn Код:
if(!strcmp(cmdtext, "/r", true, 2) && strlen(cmdtext) = 2)
{
new string[128], Player[MAX_PLAYER_NAME];
GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
format(string, 128, "RADIO: %s: %s", Player, cmdtext[2]);
for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i]==gTeam[playerid]) SendClientMessage(i, COLOR_GREEN, string);
return 1;
}
try that ^
Re: Radio with space? -
Jeffry - 04.11.2010
I'm sorry Bessensap, but I think this won't work.
Look: The '/r' has a lenght of 2, so if you type anything more, it is never 2 again, which means you can type /r, but the following will give Unknown Command.
Try:
pawn Код:
if(!strcmp(cmdtext, "/r", true, 2) && cmdtext[2]==' ')
{
new string[128], Player[MAX_PLAYER_NAME];
GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
format(string, 128, "RADIO: %s: %s", Player, cmdtext[3]);
for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i]==gTeam[playerid]) SendClientMessage(i, COLOR_GREEN, string);
return 1;
}
Re: Radio with space? -
arasone - 04.11.2010
I dont understand what you want. You want to change the /r command or ?
Re: Radio with space? -
Mean - 04.11.2010
Nevermind, I got it working with zcmd
Thanks for helping
Re: Radio with space? -
gychem - 04.11.2010
Try this,
Код:
if(strcmp(cmd, "/radio", true) == 0 || strcmp(cmd, "/r", true) == 0)
{
new string[128], Player[MAX_PLAYER_NAME];
GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
format(string, 128, "RADIO: %s: %s", Player, cmdtext[3]);
for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i]==gTeam[playerid]) SendClientMessage(i, COLOR_GREEN, string);
return 1;
}