[HELP]Team Radio
#1

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?
Reply
#2

remove "str1 = strval(tmp);"
and alter
"format(str,sizeof(str),"[Team Radio] (%s): %s",pName,tmp);"


Should do the trick
Reply
#3

When I type "/r" now, it pops up as "[Team Radio] (%s): /r"
Reply
#4

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;
		}
	}
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)