SAMP BANS Help! :)
#1

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!
Reply
#2

This command is made by you or?
Reply
#3

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
Reply
#4

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.
Reply
#5

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.
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)