SA-MP Forums Archive
Players abusing SendClientMessage - 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)
+--- Thread: Players abusing SendClientMessage (/showthread.php?tid=622699)



Players abusing SendClientMessage - TheDarkBlade - 25.11.2016

Recently players started exploiting the SendClientMessage function.
For example if you write /report %s the server will try to output , but as the string contains %s the server would crash .
I'm sorry for my english but i'm doing my best .
an example would be :
Report from TheDarkBlade [2, level 3]: %s"

So i'm hoping for a golbal fix


Re: Players abusing SendClientMessage - Abagail - 25.11.2016

Show the code you use for the report command.


Re: Players abusing SendClientMessage - TheDarkBlade - 25.11.2016

PHP код:
 if(PlayerInfo[playerid][pAdmin] == && PlayerInfo[playerid][pHelper] <= 0)
            {
            if(
ReportTime[playerid] == 4) return SCM(playeridCOLOR_WHITE,"{f03337}Dupa 4 minute poti folosi aceasta actiune.");
            
//new sendername[MAX_PLAYER_NAME], string[300];
            
GetPlayerName(playeridsendernamesizeof(sendername));
            
SendClientMessage(playeridCOLOR_YELLOW"Report submitted.");
            
format(stringsizeof(string), "Report from %s [%d, level %d]: %s"sendername,playerid,PlayerInfo[playerid][pLevel],inputtext);
            
format(reporttext[playerid], sizeof(string), string);
            
ABroadCast(COLOR_REPORT,string,1);
            
ReportTime[playerid] = 4;
              
timerreport[playerid] = SetTimerEx("Reportul"2400000"%d"playerid);
              }
            else return 
SendClientMessage(playeridCOLOR_WHITE"You are an admin/helper 
PHP код:
public ABroadCast(color,const string[],level)
{
    foreach(
Playeri)
    {
        if(
IsPlayerConnected(i))
        {
            if(
gPlayerLogged[i] == 1)
            {
                if (
PlayerInfo[i][pAdmin] >= level)
                {
                    
SendClientMessage(icolorstring);
                }
            }
        }
    }
    
printf("%s"string);
    return 
1;




Re: Players abusing SendClientMessage - Konstantinos - 25.11.2016

Let the players write the command's parameters in chat mode and not a dialog, it converts % automatically to #

Otherwise you'll need to search in inputtext for sign character and return an error for invalid character.


Re: Players abusing SendClientMessage - Vince - 25.11.2016

As far as I know percent signs are replaced with pound signs (#) on the client before anything is even sent to the server for precisely this reason. Or perhaps this only works in OnPlayerText, not sure. Either way, should be an easy fix if you use strfind.


Re: Players abusing SendClientMessage - ISmokezU - 25.11.2016

%% - one % in the mainchat,%%%%- for 2 etc etc


Re: Players abusing SendClientMessage - TheDarkBlade - 25.11.2016

so something like
PHP код:
if(strfind(inputtext,"%%") == 0) return SendClientMessage(playerid,COLOR_RED1,"Nu mai fi taran"); 
would work ?


Re: Players abusing SendClientMessage - Micko123 - 25.11.2016

I just tried on localhost and no metter how much i type %%% output is always #


Re: Players abusing SendClientMessage - Konstantinos - 25.11.2016

You use double percent sign in format function only, you search for a single in strfind.


Re: Players abusing SendClientMessage - ISmokezU - 25.11.2016

Quote:
Originally Posted by Micko123
Посмотреть сообщение
I just tried on localhost and no metter how much i type %%% output is always #
Код:
SendClientMessage(playerid, -1,"i'm a 100%% sure you didn't try this.");