Need help with a Command
#1

Okay, I am back again, but this time I have another problem.

What I would like to do is this: Lets say I have my /ban command, I can /ban ID, and I get the message saying the player is banned from the server, but what I need help with doing is, specifying a reason. I have tried using many different things in pawno, but I could not figure it out 100%, so I look upon the SA:MP forum so someone can help me, once again, the code is noted below.

Code

pawn Код:
dcmd_ban(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new
                    giveplayerid,
                    givePlayerName[MAX_PLAYER_NAME];

        if(!strlen(params))
        {
            SendClientMessage(playerid, 0xFF0000FF, "Invalid Params ! > ' /ban ID '");
            return 1;
        }
            giveplayerid = strval(params);

        GetPlayerName(giveplayerid, givePlayerName, sizeof(givePlayerName));

            if(IsPlayerConnected(giveplayerid))
                {
                new string[39];
            format(string, sizeof(string), "You have banned player %s: ID(%i)", givePlayerName, playerid);
            SendClientMessage(playerid, 0xFF0000FF, string);
            format(string, sizeof(string), "Player: %s: ID(%i) has been banned from the server!", givePlayerName,playerid);
            SendClientMessageToAll(0xFF0000FF, string);
            SendClientMessage(giveplayerid, 0xFF0000FF, "You have been banned from the server!");
            Ban(giveplayerid);
            return 1;
                }
                else
                {
            SendClientMessage(playerid, 0xFF0000FF, "[server] Error: Player is not active!");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000FF, "You are not an admin with the required level!");
        return 1;
    }
}
Any help with this subject is appreciated, thank you very much

Hiitchy - Oui, Tu Comprends?
Reply
#2

[Bump] After 12h, can anyone help?
Reply
#3

Search for sscanf on samp wiki
Reply
#4

https://sampwiki.blast.hk/wiki/Fast_Commands#sscanf
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)