No message in /wt
#1

Another Problem, AGAIN!

so, this is the problem. i did /wt and no message appears (WT = WALKIETALKIE)
Here is the picture


CODES:
/wt codes
Код:
CMD:wt(playerid, params[])
{
	if(PlayerInfo[playerid][pRadio] == 1)
	{
		if(isnull(params))
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "[USAGE] /wt [chat]");
			SendClientMessageEx(playerid, COLOR_GRAD2, "[HINT] Type /setfreq to set the frequency of your Walkie Talkie.");
			return 1;
		}

		if(PlayerInfo[playerid][pRadioFreq] >= 1 || PlayerInfo[playerid][pRadioFreq] <= -1)
		{
			if(GetPVarInt(playerid, "Injured") != 0||PlayerCuffed[playerid]!=0||GetPVarInt(playerid, "Hospital")!=0)
			{
				SendClientMessageEx (playerid, COLOR_GRAD2, "You cannot do this at this time.");
				return 1;
			}
			RadioBroadCast(playerid, COLOR_GREY, params);
			return 1;
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GRAD2, "The frequency of your radio is set to 0, you can not broadcast over that frequency.");
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "You do not have a Walkie Talkie!");
	}
	return 1;
}
RadioBroadcast Code
Код:
public RadioBroadCast(playerid, color, string[])
{
	new MiscString[256], Float: aaaPositions[3];
	new String[256],
	foreach(Player, i)
	{
		if(PlayerInfo[i][pRadioFreq] == PlayerInfo[playerid][pRadioFreq] && PlayerInfo[i][pRadio] >= 1 && gRadio[i] != 0)
		{
			GetPlayerPos(i, aaaPositions[0], aaaPositions[1], aaaPositions[2]);
			format(MiscString, sizeof(MiscString), "[WT:%d] {75AE5D}%s : %s", PlayerInfo[playerid][pRadioFreq], GetPlayerNameEx(playerid), String);
			SendClientMessageEx(i, COLOR_YELLOW, MiscString);
			format(MiscString, sizeof(MiscString), "[<WT>]\n* %s *", String);
			SetPlayerChatBubble(i, MiscString, 0x75AE5D00, 5.0, 5000);
		}
		if(AdminReadPm[i] == true)
        {
  	        format(MiscString, sizeof(MiscString), "[WT:%d] {75AE5D}%s : %s", PlayerInfo[playerid][pRadioFreq], GetPlayerNameEx(playerid), String);
			SendClientMessage(i, COLOR_YELLOW, MiscString);
        }
	}
}
Reply
#2

Change "String" to "string"
Reply
#3

which string? remake the code 4 me
Reply
#4

Код:
public RadioBroadCast(playerid, color, string[])
{
	new MiscString[256], Float: aaaPositions[3];
	new String[256],
	foreach(Player, i)
	{
		if(PlayerInfo[i][pRadioFreq] == PlayerInfo[playerid][pRadioFreq] && PlayerInfo[i][pRadio] >= 1 && gRadio[i] != 0)
		{
			GetPlayerPos(i, aaaPositions[0], aaaPositions[1], aaaPositions[2]);
			format(MiscString, sizeof(MiscString), "[WT:%d] {75AE5D}%s : %s", PlayerInfo[playerid][pRadioFreq], GetPlayerNameEx(playerid), string);
			SendClientMessageEx(i, COLOR_YELLOW, MiscString);
			format(MiscString, sizeof(MiscString), "[<WT>]\n* %s *", string);
			SetPlayerChatBubble(i, MiscString, 0x75AE5D00, 5.0, 5000);
		}
		if(AdminReadPm[i] == true)
        {
  	        format(MiscString, sizeof(MiscString), "[WT:%d] {75AE5D}%s : %s", PlayerInfo[playerid][pRadioFreq], GetPlayerNameEx(playerid), String);
			SendClientMessage(i, COLOR_YELLOW, MiscString);
        }
	}
}
You've used String instead of string, Here is the RadioBroadcast public, replace it with your one
Reply
#5

How is RadioBroadCast not giving compiler errors? You've got an open declaration.
Код:
new MiscString[256], Float: aaaPositions[3];
	new String[256],
Reply
#6

use sscanf instead of this
PHP код:
        if(isnull(params))
        {
            
SendClientMessageEx(playeridCOLOR_WHITE"[USAGE] /wt [chat]");
            
SendClientMessageEx(playeridCOLOR_GRAD2"[HINT] Type /setfreq to set the frequency of your Walkie Talkie.");
            return 
1;
        } 
scanff also formats this params as string for u.
Reply
#7

Quote:
Originally Posted by Mugala
Посмотреть сообщение
use sscanf instead of this
PHP код:
        if(isnull(params))
        {
            
SendClientMessageEx(playeridCOLOR_WHITE"[USAGE] /wt [chat]");
            
SendClientMessageEx(playeridCOLOR_GRAD2"[HINT] Type /setfreq to set the frequency of your Walkie Talkie.");
            return 
1;
        } 
scanff also formats this params as string for u.
Nope,
As of my knowledge as it's only 1 params, Cause you only need text after /wt..
So isnull will work same as sscanf and isnull will work faster..
Reply
#8

Now i got many error codes on the line that has "i"
Код:
error 017: undefined symbol "i"
and on the "foreach" line, it appeared this error code
Код:
error 001: expected token: "-identifier-", but found "for"
Reply
#9

Here's the fix code, You were using " , " instead of " ; "
Код:
public RadioBroadCast(playerid, color, string[])
{
	new MiscString[256], Float: aaaPositions[3] , String[256];
	foreach(Player, i)
	{
		if(PlayerInfo[i][pRadioFreq] == PlayerInfo[playerid][pRadioFreq] && PlayerInfo[i][pRadio] >= 1 && gRadio[i] != 0)
		{
			GetPlayerPos(i, aaaPositions[0], aaaPositions[1], aaaPositions[2]);
			format(MiscString, sizeof(MiscString), "[WT:%d] {75AE5D}%s : %s", PlayerInfo[playerid][pRadioFreq], GetPlayerNameEx(playerid), string);
			SendClientMessageEx(i, COLOR_YELLOW, MiscString);
			format(MiscString, sizeof(MiscString), "[<WT>]\n* %s *", string);
			SetPlayerChatBubble(i, MiscString, 0x75AE5D00, 5.0, 5000);
		}
		if(AdminReadPm[i] == true)
        {
  	        format(MiscString, sizeof(MiscString), "[WT:%d] {75AE5D}%s : %s", PlayerInfo[playerid][pRadioFreq], GetPlayerNameEx(playerid), String);
			SendClientMessage(i, COLOR_YELLOW, MiscString);
        }
	}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)