/report not working
#1

It won't show the reason for why the player is being reported.

PHP код:
CMD:report(playeridparams[]) // Commands                                                           ***********
{
    new 
name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[128],reason[128],id;
    if(
sscanf(params,"ds[64]",id)) return SendClientMessage(playerid,COL_WHITE,"USAGE: /report [Reason]");
    
GetPlayerName(playerid,name,sizeof(name));
    
GetPlayerName(id,name2,sizeof(name2));
       if(
PlayerInfo[id][pAdmin]>0)
    {
        
format(string,128,"%s reported %s for %s",name,name2,reason);
        
SendClientMessage(id,COL_WHITE,string);
    }
    return 
1;

Reply
#2

You forgot to add ", reason" to your sscanf function call.
You also don't need a 128-cell array for reason if you're only going to use 64 in your sscanf.

pawn Код:
CMD:report(playerid, params[]) // Commands                                                           ***********
{
    new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[128],reason[64],id;
    if(sscanf(params,"ds[64]",id, reason)) return SendClientMessage(playerid,COL_WHITE,"USAGE: /report [Reason]");
    GetPlayerName(playerid,name,sizeof(name));
    GetPlayerName(id,name2,sizeof(name2));
       if(PlayerInfo[id][pAdmin]>0)
    {
        format(string,128,"%s reported %s for %s",name,name2,reason);
        SendClientMessage(id,COL_WHITE,string);
    }
    return 1;
}
Reply
#3

pawn Код:
CMD:report(playerid, params[]) // Commands                                                           ***********
{
    new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[128],reason[128],id;
    if(sscanf(params,"ds[64]",id,reason)) return SendClientMessage(playerid,COL_WHITE,"USAGE: /report [ID] [Reason]");
    GetPlayerName(playerid,name,sizeof(name));
    GetPlayerName(id,name2,sizeof(name2));
       if(PlayerInfo[id][pAdmin]>0)
    {
        format(string,128,"%s reported %s for %s",name,name2,reason);
        SendClientMessage(id,COL_WHITE,string);
    }
    return 1;
}
Reply
#4

Huh, i really can't see how it will send message to admins.

You need something like:
pawn Код:
foreach(new i : Player)
{
    if(PlayerInfo[i][pAdmin] > 0)
    {
        // send....
    }
}
Reply
#5

pawn Код:
CMD:report(playerid, params[]) // Commands                                                           ***********
{
    new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[128],reason[128],id;
    if(sscanf(params,"ds[64]",id,reason)) return SendClientMessage(playerid,COL_WHITE,"USAGE: /report [ID] [Reason]");
    GetPlayerName(playerid,name,sizeof(name));
    GetPlayerName(id,name2,sizeof(name2));

    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pAdmin]>0)
            {
                format(string,128,"%s reported %s for %s",name,name2,reason);
                SendClientMessage(id,COL_WHITE,string);
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)