Help... problem when using Strings
#1

Code:

Код:
GetPlayerName(i, nameh, sizeof(nameh));
        SendClientMessageToAll(0xFFFFFFFF, ">> %s(%d) has been banned for failing to Login onto RCON!",nameh,i);
        BanEx(i, "Wrong RCON Password" );
Error:

Код:
C:\Users\Henrique\Desktop\SAMP - The Project\Dir\gamemodes\Testmode.pwn(284) : error 001: expected token: ";", but found "-identifier-"
C:\Users\Henrique\Desktop\SAMP - The Project\Dir\gamemodes\Testmode.pwn(285) : warning 202: number of arguments does not match definition
C:\Users\Henrique\Desktop\SAMP - The Project\Dir\gamemodes\Testmode.pwn(285) : warning 202: number of arguments does not match definition
What am i doing wrong?

btw would also like to eliminate these warnings

Code:

Код:
if(strlen(gMessage) > 0) {
				format(Message,sizeof(Message),"Reason: %s",gMessage);
   }
   			SendClientMessageToAll(ADMINFS_MESSAGE_COLOR, ">> %s(%d) has been banned. PWNTD!!! Reason:%s",iName,id,gMessage);
   			
			printf("WARNING,%s(%d) has been banned. Reason:%s",iName,id,gMessage);
			BanEx(id, gMessage);
			return 1;
Warnings:


Код:
C:\Users\Henrique\Desktop\SAMP - The Project\Dir\filterscripts\base_for_AIRPORT_TDM.pwn(138) : warning 202: number of arguments does not match definition
C:\Users\Henrique\Desktop\SAMP - The Project\Dir\filterscripts\base_for_AIRPORT_TDM.pwn(138) : warning 202: number of arguments does not match definition
C:\Users\Henrique\Desktop\SAMP - The Project\Dir\filterscripts\base_for_AIRPORT_TDM.pwn(138) : warning 202: number of arguments does not match definition
Ima go sleep now, so im not awnswerin this for some time.

P.S: on Problem 1, i is already defined and no problems with it, the problem is nameh(String where i want name to be stored so i can use it on my global message for ban).
Reply
#2

SendClientMessageToAll does not have the ability to format messages, for that you need to use the format function to format an array and then send it. For example:

pawn Код:
format(Message, sizeof(Message), ">> %s(%d) has been banned. PWNTD!!! Reason:%s",iName,id,gMessage);

SendClientMessageToAll(ADMINFS_MESSAGE_COLOR, Message);
Reply
#3

You have to format a string then send it to the players.

pawn Код:
new string[128];

GetPlayerName(i, nameh, sizeof(nameh));
format(string,128,">> %s(%d) has been banned for failing to Login onto RCON!",nameh,i);
SendClientMessageToAll(0xFFFFFFFF, string);
BanEx(i, "Wrong RCON Password" );
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)