SA-MP Forums Archive
Help me, please /a chat - 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 me, please /a chat (/showthread.php?tid=278881)



Help me, please /a chat - Jafet_Macario - 24.08.2011

So, I'm trying to make an admin chat, basically admins can speak with eachother using the command /a [text]
But, I got this command:
pawn Code:
CMD:a(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME], result[128], string[128];
    if(!(PlayerInfo[playerid][pAdmin] >= 1)) return SCM(playerid, COLOR_GREY,"You are not authorized to use this command");
    if(sscanf(params,"s[128]", result)) return SCM(playerid, COLOR_GOLD,"USAGE: /a [chat]");
    else
    {
        format(string, sizeof(string),"*%d Admin %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
        SendAdminMessage(COLOR_GOLD, string);
    }
    return 1;
}
Every time I type for example: /a hello, or anything, I'm getting always this message: "USAGE: /a [chat]", any help, please?


Re: Help me, please /a chat - =WoR=Varth - 24.08.2011

pawn Code:
CMD:a(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME];
    if(!PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid, COLOR_GREY,"You are not authorized to use this command");
    if(isnull(params)) return SCM(playerid,COLOR_GOLD,"USAGE: /a [chat]");
    GetPlayerName(playerid,sendername,sizeof(sendername));
    format(string,160,"*%d Admin %s: %s",PlayerInfo[playerid][pAdmin],sendername,params);
    SendAdminMessage(COLOR_GOLD, string);
    return 1;
}



Re: Help me, please /a chat - Jafet_Macario - 24.08.2011

Damn thanks, noticed that I got the same problem on this command:
pawn Code:
CMD:kick(playerid, params[])
{
    new id, sendername[MAX_PLAYER_NAME], string[128], reason[128];
    if(!PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid, COLOR_GREY,"  you are not authorized to use this command");
    if(sscanf(params,"us[128]",id, reason)) return SCM(playerid, COLOR_WHITE,"USAGE: /kick [playerid/partofname] [reason]");
    if(id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_WHITE,"Player is not connected");
    else
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", id, sendername, reason);
        SendClientMessageToAll(COLOR_LIGHTRED,string);
        Kick(id);
    }
    return 1;
}
But I think I can't check if is null because there are 2 parameters? How to make here?


Re: Help me, please /a chat - =WoR=Varth - 24.08.2011

sscanf have isnull in-build code.

pawn Code:
CMD:kick(playerid,params[])
{
    new id,name1[MAX_PLAYER_NAME]name2[MAX_PLAYER_NAME];
    if(!PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid, COLOR_GREY,"  you are not authorized to use this command");
    if(sscanf(params,"us[128]",id,params)) return SCM(playerid, COLOR_WHITE,"USAGE: /kick [playerid/partofname] [reason]");
    if(!IsPlayerConnected(id)) return SCM(playerid, COLOR_WHITE,"Player is not connected");
    GetPlayerName(playerid,name1,sizeof(name1));
    GetPlayerName(id,name2,sizeof(name2));
    format(params,129, "AdmCmd: %s was kicked by %s, reason: %s",name2,name1,params);
    SendClientMessageToAll(COLOR_LIGHTRED,params);
    Kick(id);
    return 1;
}



Re: Help me, please /a chat - Jafet_Macario - 24.08.2011

^^ thanks again