[HELP]Team Radio - 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: [HELP]Team Radio (
/showthread.php?tid=124710)
[HELP]Team Radio -
VonLeeuwen - 31.01.2010
Hey all,
I made a kind of team radio xD and it fails...
When I type /r hellooooo it shows up as '[Team Radio] (VonLeeuwen):'
This is my script
Код:
if(!strcmp(cmd, "/r", true, 2))
{
new str[128],str1,pName[MAX_PLAYER_NAME];
tmp = strtok(cmdtext,idx);
str1 = strval(tmp);
GetPlayerName(playerid,pName,sizeof(pName));
format(str,sizeof(str),"[Team Radio] (%s): %s",pName,str1);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(gTeam[i] == gTeam[playerid])
{
SendClientMessage(i,lightblue,str);
return 1;
}
}
}
What did I do wrong?
Re: [HELP]Team Radio -
ray187 - 31.01.2010
remove "str1 = strval(tmp);"
and alter
"format(str,sizeof(str),"[Team Radio] (%s): %s",pName,tmp);"
Should do the trick
Re: [HELP]Team Radio -
VonLeeuwen - 31.01.2010
When I type "/r" now, it pops up as "[Team Radio] (%s): /r"
Re: [HELP]Team Radio -
ray187 - 31.01.2010
Weird, but if thats the case (and you did it correct) try:
Код:
if(!strcmp(cmd, "/r", true, 2))
{
new str[128],pName[MAX_PLAYER_NAME];
strtok(cmdtext,idx);
tmp=strtok(cmdtext,idx);
GetPlayerName(playerid,pName,sizeof(pName));
format(str,sizeof(str),"[Team Radio] (%s): %s",pName,tmp);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(gTeam[i] == gTeam[playerid])
{
SendClientMessage(i,lightblue,str);
return 1;
}
}
}