SA-MP Forums Archive
[Help me] Command problem - 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)
+--- Thread: [Help me] Command problem (/showthread.php?tid=361628)



[Help me] Command problem - umarmalik - 21.07.2012

I have a problem by converting zcmd to strcmp. Some one convert this command to strcmp with no Rcon login call. just simple "if (PlayerInfo[playerid][pAdmin] >= 1)" and that inform all players that player got ban like this "format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s".

here is the command:

pawn Код:
COMMAND:ban(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[SAMP-BANS]: You need to be logged in as an RCON administrator to perform this!");
    if(sscanf(params, "uis", ban_target, ban_time, ban_reason)) return SendClientMessage(playerid, COLOR_RED, "[SAMP-BAN]: Correct usage -> /ban <player> <time (minutes)> <reason>");
    if(!IsPlayerConnected(ban_target)) return SendClientMessage(playerid, COLOR_RED, "[SAMP-BANS]: Player was not found!");
    if(ban_time < 0) SendClientMessage(playerid, COLOR_RED, "[SAMP-BANS]: Please input a valid ban time!");

    format(post_string, sizeof(post_string), "action=addban&apikey="#APIKEY"&ban_user=%s&ban_reason=%s&ban_admin=%s&ban_ip=%s&ban_time=%d",names[ban_target], ban_reason, names[playerid], ips[ban_target], ban_time);

    HTTP(playerid, HTTP_POST, APIPATH, post_string, "OnBanResponse");

    Kick(ban_target);
    return 1;
}