SA-MP Forums Archive
Need help with a Command - 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: Need help with a Command (/showthread.php?tid=113980)



Need help with a Command - Hiitch - 17.12.2009

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?


Re: Need help with a Command - Hiitch - 18.12.2009

[Bump] After 12h, can anyone help?


Re: Need help with a Command - yom - 18.12.2009

Search for sscanf on samp wiki


Re: Need help with a Command - hoodline - 18.12.2009

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