CMD warn
#1

Код:
D:\My server\gamemodes\TDM_Script.pwn(1630) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Код:
SendMessageToAdmins(COLOR_ADMIN, string);
Reply
#2

Can you show the function "SendMessageToAdmins();" ?
Reply
#3

Show the full conmand + that function/stock for SendMessageToAdmins
Reply
#4

Код:
CMD:ac(playerid, params[])
{
 new tmp[256], playername[25], string[256];
 if (adlvl[playerid] < 1) return 0;
 if (sscanf(params, "s[128]", tmp)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /ac [message]");
 GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
 format(string, sizeof(string), "Admin Chat [%s] %s", playername, tmp);
 SendMessageToAdmins(COLOR_ADMIN, string);
 print(string);
 return 1;
}
This is the full code

and i added

#define SendMessageToAdmins.
Reply
#5

PHP код:
stock SendMessageToAdmins(fromidcolourmsg[])
{
    new 
pName[MAX_PLAYER_NAME], string[128]; //Why 128? 128 is the MAX size of CHAT TEXT
    
GetPlayerName(fromidpNameMAX_PLAYER_NAME);
    
format(stringsizeof(string), "%s: %s"pNamemsg);
    for(new 
iGetMaxPlayers(); i++)
    {
        if(
IsPlayerAdmin(i))
        {
            
SendClientMessage(icolourstring);
        }
    }

You should use it like that, not with the define. Change the variables of admin to yours.
Reply
#6

Quote:
Originally Posted by KamalBa
Посмотреть сообщение
Код:
CMD:ac(playerid, params[])
{
 new tmp[256], playername[25], string[256];
 if (adlvl[playerid] < 1) return 0;
 if (sscanf(params, "s[128]", tmp)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /ac [message]");
 GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
 format(string, sizeof(string), "Admin Chat [%s] %s", playername, tmp);
 SendMessageToAdmins(COLOR_ADMIN, string);
 print(string);
 return 1;
}
This is the full code

and i added

#define SendMessageToAdmins.
How is pawno supposed to know what to make of "#define SendMessageToAdmins" you could use this;

Код:
stock SendMessageToAdmins(color, message[])
{
	for(new i = 0; i < GetMaxPlayers(); i++)
	{
		if(pData[i][Admin] > 0) // You'll have to change this to your own var
		{
			SendClientMessage(i, color, message);
		}
	}
}
Also returning 0 gives normal players the message: SERVER: Unknown Command
tmp[256] isnt needed, you can use tmp[129](i cantremember if the null cell is needed)
Reply
#7

bogushas About the code you gave me not working!

JaydenJason

Where to add the code you gave me at the top of the script or under the CMD
Reply
#8

You can put it anywhere since it's a function but you don't put it under the CMD.
Reply
#9

and after that i need to put

return 1;
or return 0; ?
Reply
#10

Added it and got those errors


D:\My server\gamemodes\TDM_Script.pwn(46) : error 017: undefined symbol "pData"
D:\My server\gamemodes\TDM_Script.pwn(46) : warning 215: expression has no effect
D:\My server\gamemodes\TDM_Script.pwn(46) : error 001: expected token: ";", but found "]"
D:\My server\gamemodes\TDM_Script.pwn(46) : error 029: invalid expression, assumed zero
D:\My server\gamemodes\TDM_Script.pwn(46) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

This is the code
Код:
stock SendMessageToAdmins(color, message[])
{
	for(new i = 0; i < GetMaxPlayers(); i++)
	{
		if(pData[i][Admin] > 0) // You'll have to change this to your own var
		}
			SendClientMessage(i, color, message);
		}
	}
	return 0;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)