Help... problem when using Strings - 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... problem when using Strings (
/showthread.php?tid=275538)
Help... problem when using Strings -
henry jiggy - 10.08.2011
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).
Re: Help... problem when using Strings -
JaTochNietDan - 10.08.2011
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);
Re: Help... problem when using Strings -
Backwardsman97 - 10.08.2011
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" );