SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Help Archive (https://forum.sa-mp.com/forumdisplay.php?f=89)
-   -   Help me, please /a chat (https://forum.sa-mp.com/showthread.php?t=278881)

Jafet_Macario 24/08/2011 10:19 AM

Help me, please /a chat
 
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?

=WoR=Varth 24/08/2011 10:32 AM

Re: Help me, please /a chat
 
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;
}

Jafet_Macario 24/08/2011 10:39 AM

Re: Help me, please /a chat
 
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?

=WoR=Varth 24/08/2011 10:48 AM

Re: Help me, please /a chat
 
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;
}

Jafet_Macario 24/08/2011 11:06 AM

Re: Help me, please /a chat
 
^^ thanks again:)


All times are GMT. The time now is 10:14 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.