SA-MP Forums Archive
SAMP BANS Help! :) - 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: SAMP BANS Help! :) (/showthread.php?tid=274911)



SAMP BANS Help! :) - OleKristian95 - 07.08.2011

pawn Код:
CMD:tempban(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR:: You need to be logged in as an RCON administrator to perform this!");
    if(sscanf(params, "usi", ban_target, ban_reason, ban_time)) return SendClientMessage(playerid, COLOR_RED, "ERROR:: Correct usage -> /ban <player> <reason> <time (days)>");
    if(!IsPlayerConnected(ban_target)) return SendClientMessage(playerid, COLOR_RED, "ERROR:: Player was not found!");
    if(ban_time < 0) SendClientMessage(playerid, COLOR_RED, "ERROR:: 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 * 60*24);
   
    new tmp[128], tmp2[128], Index;     tmp = strtok(params,Index), tmp2 = strtok(params,Index);
    new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
    player1 = strval(tmp);
    GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
    format(string,sizeof(string),"|- %s has been Temporary Banned by Administrator %s | Reason: %s | Days: %s",playername,adminname,ban_reason,ban_time * 60*24);
    SendClientMessageToAll(lightred,string);

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

    Kick(ban_target);
    return 1;
}
Can you help me make it say how many days I have given, when I tested this code it said days as est I gave reason Test.

I also want to replace "if(!IsPlayerAdmin(playerid))" with "if(PlayerInfo[playerid][Level] >= {" Please help me with that also if you can!


Re: SAMP BANS Help! :) - Kingunit - 07.08.2011

This command is made by you or?


Re: SAMP BANS Help! :) - Shockey HD - 07.08.2011

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
This command is made by you or?
What does this have to do with his problem?

I suggest you read up about SSCANF a little more. Its pretty much self Explanatory. Give it a shot


Re: SAMP BANS Help! :) - Kingunit - 07.08.2011

Quote:
Originally Posted by Shockey HD
Посмотреть сообщение
What does this have to do with his problem?

I suggest you read up about SSCANF a little more. Its pretty much self Explanatory. Give it a shot
Because if it isn't created by him, it's better to start again.


Re: SAMP BANS Help! :) - Shockey HD - 07.08.2011

Well, Not really. He could be learning sscanf, using someone else's code. I suggest him to study the code, learn how samp works and go from there.


Re: SAMP BANS Help! :) - OleKristian95 - 07.08.2011

The command is from JaTochNietDan's SAMP-BANS Example Filterscript
The part where it gives all a message about the ban is from Lethal admin in SATDM~RP V9.

I would like to learn what SSCANF is but don't know where to start and would be cool if I got this command to work today or at least in a few days so would it would be nice if someone just gave me the code I need.