SA-MP Forums Archive
ban and unban - 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: ban and unban (/showthread.php?tid=600899)



ban and unban - Deny1 - 14.02.2016

Код:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pLogovan] < 1) return SCM(playerid, -1, "Not logged");
    if(PlayerInfo[playerid][pAdmin] < 3) return SCM(playerid, -1, "No perm");

    new
        playerID,
        reason[32]
    ;

    if(sscanf(params, "us[32]", playerID, reason)) return SCM(playerid, COLOR_GREY, "CMD: /ban [id] [reason]");
    if(!IsPlayerConnected(playerID)) return SCM(playerid, COLOR_GREY, "Not online!");

    new
        playerName[MAX_PLAYER_NAME],
        targetName[MAX_PLAYER_NAME],
        reason[64],
        string[144],
        string2[144],
		id
    ;

    GetPlayerName(playerid, playerName, sizeof(playerName));
    GetPlayerName(playerID, targetName, sizeof(targetName));

    format(string, sizeof(string), "'%s was baned by %s.", targetName, playerName);
    SCMTL(COLOR_RED, string);
    SCM(playerid, -1, "you are baned!");
	format(string2,sizeof(string2),"SRW; You are baned  %s | Reason: %s",playerName,reason);
    SCM(id,-1,string2);
    SetTimerEx("Ban", 1000, false, "i", playerid);
   
    format(string, sizeof(string), "'%s was banned by %s |Reason: %s ", targetName, playerName, reason);
    SendMessageToAdmins(0xFF6347FF, string, 1);
    return 1;
}
This is my ban cmd but when i ban player he doesn't recive reason only show srw you are baned ... | Reason: .And how to make unban for this cmmd


Re: ban and unban - zPain - 14.02.2016

I believe this is the problematic snippet.

PHP код:
SCM(playerid, -1"you are baned!");
format(string2,sizeof(string2),"SRW; You are baned  %s | Reason: %s",playerName,reason);
SCM(id,-1,string2);
SetTimerEx("Ban"1000false"i"playerid); 
Replace it with the code below:
PHP код:
SCM(playerID, -1"you are baned!");
format(string2,sizeof(string2),"SRW; You are baned  %s | Reason: %s",playerName,reason);
SCM(playerID,-1,string2);
SetTimerEx("Ban"1000false"i"playerID); 
By the way, you can format the same string multiple times. There's no need to create another array.


Re: ban and unban - Deny1 - 14.02.2016

what's with unban ?


Re: ban and unban - zPain - 14.02.2016

https://sampwiki.blast.hk/wiki/Controlling_Your_Server


Re: ban and unban - LovelySoomro - 14.02.2016

Quote:

dcmd_unban(playerid,params[])
{
if(AccInfo[playerid][Level] >= 4)
{
if(AccInfo[playerid][afk] == 1)return SendClientMessage( playerid,red," You cannot use this command While You In a Afk Plz Type /back First Thank You!");
if(!IsPlayerSpawned(playerid))return SendClientMessage( playerid, RED, " You must be spawned to Use This Command!"), 0;

new tmp[256], Index;
tmp = strtok(params,Index);
if(!strlen(tmp)) return
SendClientMessage(playerid,red , "{6EF83C}[NGP]:{FFFFFF} /unban [Player Name]");

dini_Get("/LuxAdmin/Accounts/%s.sav",udb_encode(PlayerName2(playerid)));
dUserSetINT(tmp).("Banned",0);
new string[400];
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
format(string, sizeof(string),"{008040}Admin has enable \"%s\",s Account.", tmp);
return SendClientMessageToAll(LIGHTBLUE,string);
}
else return ErrorMessages(playerid, 4);
}

example...