SA-MP Forums Archive
SendClientMessageToAll bug - 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: SendClientMessageToAll bug (/showthread.php?tid=309603)



SendClientMessageToAll bug - Gooday - 08.01.2012

Hi. I added the skins so only the FD/PD skins can see the message. But when someone use the command all can see the message.
If i change SendClientMessageToAll with SendClientMessage i got errors. Please how to fix

pawn Код:
CMD:911(playerid,params[])
{
        //911 system
        if(isnull(params)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage: /911 [Message and Location]");
        new name[24];
        new sendername[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        GetPlayerName(playerid,name,24);
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, sizeof(playername));
        SendClientMessage(playerid, COLOR_GOLD, "[INFO]You have just called 911. Please remain at your location and wait.");

        for(new i=0;i<MAX_PLAYERS;i++)
        {if(GetPlayerSkin(i) == 285 || GetPlayerSkin(i) == 282 || GetPlayerSkin(i) == 281 || GetPlayerSkin(i) == 283 || GetPlayerSkin(i) == 288 ||GetPlayerSkin(i) == 278  || GetPlayerSkin(i) == 275 || GetPlayerSkin(i) == 279 || GetPlayerSkin(i) == 277 || GetPlayerSkin(i) == 274 || GetPlayerSkin(i) == 276)
            {
                format(string, sizeof(string), "-------------------------------------------------------------------------------------------------", sendername, params);
                SendClientMessageToAll(COLOR_GREY, string);
                format(string, sizeof(string), "DISPATCH", sendername, params);
                SendClientMessageToAll(COLOR_ROYALBLUE, string);
                format(string, sizeof(string), "Be advised, the following is a 911 call.", sendername, params);
                SendClientMessageToAll(COLOR_GREY, string);
                format(string, sizeof(string), "Units aviable please respond.", sendername, params);
                SendClientMessageToAll(COLOR_GREY, string);
                format(string, sizeof(string), "CALLER: %s  ~  INFO & LOCATION: %s", sendername, params);
                SendClientMessageToAll(COLOR_GREY, string);
                format(string, sizeof(string), "-------------------------------------------------------------------------------------------------", sendername, params);
                SendClientMessageToAll(COLOR_GREY, string);
                }

        }
        return 1;
}
+REP!!!!!!!!!!!


Re: SendClientMessageToAll bug - IstuntmanI - 08.01.2012

Change
Код:
for(new i=0;i<MAX_PLAYERS;i++)
        {if(GetPlayerSkin(i) == 285 || GetPlayerSkin(i) == 282 || GetPlayerSkin(i) == 281 || GetPlayerSkin(i) == 283 || GetPlayerSkin(i) == 288 ||GetPlayerSkin(i) == 278  || GetPlayerSkin(i) == 275 || GetPlayerSkin(i) == 279 || GetPlayerSkin(i) == 277 || GetPlayerSkin(i) == 274 || GetPlayerSkin(i) == 276)
            {
                format(string, sizeof(string), "-------------------------------------------------------------------------------------------------", sendername, params);
                SendClientMessageToAll(COLOR_GREY, string);
                format(string, sizeof(string), "DISPATCH", sendername, params);
                SendClientMessageToAll(COLOR_ROYALBLUE, string);
                format(string, sizeof(string), "Be advised, the following is a 911 call.", sendername, params);
                SendClientMessageToAll(COLOR_GREY, string);
                format(string, sizeof(string), "Units aviable please respond.", sendername, params);
                SendClientMessageToAll(COLOR_GREY, string);
                format(string, sizeof(string), "CALLER: %s  ~  INFO & LOCATION: %s", sendername, params);
                SendClientMessageToAll(COLOR_GREY, string);
                format(string, sizeof(string), "-------------------------------------------------------------------------------------------------", sendername, params);
                SendClientMessageToAll(COLOR_GREY, string);
                }

        }
to
Код:
for(new i=0;i<MAX_PLAYERS;i++)
        {if(GetPlayerSkin(i) == 285 || GetPlayerSkin(i) == 282 || GetPlayerSkin(i) == 281 || GetPlayerSkin(i) == 283 || GetPlayerSkin(i) == 288 ||GetPlayerSkin(i) == 278  || GetPlayerSkin(i) == 275 || GetPlayerSkin(i) == 279 || GetPlayerSkin(i) == 277 || GetPlayerSkin(i) == 274 || GetPlayerSkin(i) == 276)
            {
                format(string, sizeof(string), "-------------------------------------------------------------------------------------------------", sendername, params);
                SendClientMessageToAll(i, COLOR_GREY, string);
                format(string, sizeof(string), "DISPATCH", sendername, params);
                SendClientMessageToAll(i, COLOR_ROYALBLUE, string);
                format(string, sizeof(string), "Be advised, the following is a 911 call.", sendername, params);
                SendClientMessageToAll(i, COLOR_GREY, string);
                format(string, sizeof(string), "Units aviable please respond.", sendername, params);
                SendClientMessageToAll(i, COLOR_GREY, string);
                format(string, sizeof(string), "CALLER: %s  ~  INFO & LOCATION: %s", sendername, params);
                SendClientMessageToAll(i, COLOR_GREY, string);
                format(string, sizeof(string), "-------------------------------------------------------------------------------------------------", sendername, params);
                SendClientMessageToAll(i, COLOR_GREY, string);
                }

        }



Re: SendClientMessageToAll bug - Gooday - 08.01.2012

What is changed o.O

Now i got:
Quote:

C:\Users\Luca\Desktop\basefixed.pwn(2874) : error 035: argument type mismatch (argument 2)
C:\Users\Luca\Desktop\basefixed.pwn(2876) : error 035: argument type mismatch (argument 2)
C:\Users\Luca\Desktop\basefixed.pwn(287 : error 035: argument type mismatch (argument 2)
C:\Users\Luca\Desktop\basefixed.pwn(2880) : error 035: argument type mismatch (argument 2)
C:\Users\Luca\Desktop\basefixed.pwn(2882) : error 035: argument type mismatch (argument 2)
C:\Users\Luca\Desktop\basefixed.pwn(2884) : error 035: argument type mismatch (argument 2)




Re: SendClientMessageToAll bug - Konstantinos - 08.01.2012

The format is useless if you don't use it. You don't have any ( %s, %d, %i, etc..)
pawn Код:
CMD:911(playerid,params[])
{
    //911 system
    if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /911 [Message and Location]");
    new sendername[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    SendClientMessage(playerid, COLOR_GOLD, "[INFO]You have just called 911. Please remain at your location and wait.");
    for(new i=0;i<MAX_PLAYERS;i++) {
        if(GetPlayerSkin(i) == 285 || GetPlayerSkin(i) == 282 || GetPlayerSkin(i) == 281 || GetPlayerSkin(i) == 283 || GetPlayerSkin(i) == 288 ||GetPlayerSkin(i) == 278  || GetPlayerSkin(i) == 275 || GetPlayerSkin(i) == 279 || GetPlayerSkin(i) == 277 || GetPlayerSkin(i) == 274 || GetPlayerSkin(i) == 276) {
            SendClientMessage(i, COLOR_GREY, "-------------------------------------------------------------------------------------------------");
            SendClientMessage(i, COLOR_ROYALBLUE, "DISPATCH");
            SendClientMessage(i, COLOR_GREY, "Be advised, the following is a 911 call.");
            SendClientMessage(i, COLOR_GREY, "Units aviable please respond.");
            format(string, sizeof(string), "CALLER: %s  ~  INFO & LOCATION: %s", sendername, params);
            SendClientMessage(i, COLOR_GREY, string);
            SendClientMessage(i, COLOR_GREY, "-------------------------------------------------------------------------------------------------");
        }

    }
    return 1;
}