[HELP]I Need Help with 3 Commands
#1

pawn Код:
CMD:ban(playerid, params[])
{
    if(!PlayerInfo[playerid][LoggedIn]) return SendClientMessage(playerid, red, "ERROR: You must be logged in to use this commands");
    if(PlayerInfo[playerid][Level] < 7) return SendClientMessage(playerid, red, "ERROR: You are not a high enough level to use this command");
    new targetid, reason[40];
    print(params);
    if(sscanf(params, "is(No Reason)[40]", targetid, reason)) return SendClientMessage(playerid, red, "USAGE: /ban [playerid] [reason]");
    if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "Player is not connected.");
    if(targetid == playerid) return SendClientMessage(playerid, red, "You cannot ban yourself.");
    if(PlayerInfo[targetid][Level] == ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid, red, "The Player You Are Trying To Ban Is The Highest Admin !");
    new PlayerName[MAX_PLAYER_NAME], AdminName[MAX_PLAYER_NAME], string[150];
    GetPlayerName(playerid, AdminName, sizeof(AdminName));
    GetPlayerName(targetid, PlayerName, sizeof(PlayerName));
    new year, month, day, hour, minute, second;
    getdate(year, month, day);
    gettime(hour, minute, second);
    format(string, sizeof(string), "{FF0000}YG INFO - %s (ID: %d) has been banned by Administrator %s (ID: %d) [Reason: %s]", PlayerName, targetid, AdminName, playerid, reason);
    SendClientMessageToAll(red, string);
    CMDMessageToAdmins(playerid, "Ban");
    SaveToFile("BanLog", string);
    aresetpall(targetid);
    print(string);
    if(udb_Exists(PlayerName2(targetid)) && PlayerInfo[targetid][LoggedIn] == 1) dUserSetINT(PlayerName2(targetid)).("banned",1);
    SendClientMessage(targetid, red, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
    SendClientMessage(targetid, red, "YOU HAVE BEEN BANNED - READ THE FOLLOWING DETAILS:");
    format(string, sizeof(string), "Your Name: %s", PlayerName);
    SendClientMessage(targetid, green, string);
    format(string, sizeof(string), "Admin Name: %s", AdminName);
    SendClientMessage(targetid, green, string);
    format(string, sizeof(string), "Date And Time: %d/%d/%d %d:%d", day, month, year, hour, minute);
    SendClientMessage(targetid, green, string);
    format(string, sizeof(string), "Reason: %s", reason);
    SendClientMessage(targetid, green, string);
    SendClientMessage(targetid, green, "(If You Wish To Make an Appeal goto YG-Gamers.tk and post in the Unban Appeals Category.)");
    SendClientMessage(targetid, red, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
    return SetTimerEx("BanTimer", 200, false, "is", playerid, reason);
}

forward BanTimer(playerid, reason[]);
public BanTimer(playerid, reason[]) return BanEx(playerid, reason);
pawn Код:
CMD:stats(playerid,params[])
{
    new targetid;
    sscanf(params, "U(-1)", targetid);
    if(targetid == -1) targetid = playerid;
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "Player Not Connected!");

    new h, m, s, pDeaths, PlayerName[MAX_PLAYER_NAME];
    TotalGameTime(targetid, h, m, s);
    GetPlayerName(targetid, PlayerName, sizeof(PlayerName));
    if(PlayerInfo[targetid][Deaths] == 0) pDeaths = 1;
        else pDeaths = PlayerInfo[targetid][Deaths];

    new fstr[1800], str[250];
    format(fstr, sizeof(fstr), "\t{FF0000}---====> {FFA500}YG Stats For %s's {FF0000}<====---\n", PlayerName);
    format(str, sizeof(str), "{F2C80C}Admin Level: {3DE3B1}%d {FFFFFF}| {F2C80C}VIP Level: {3DE3B1}%d{FFFFFF} | {F2C80C}Interior: {3DE3B1}%d{FFFFFF} | {F2C80C}Maths Quiz Won: {3DE3B1}%d{FFFFFF},\n", PlayerInfo[targetid][Level], PlayerInfo[targetid][dRank], GetPlayerInterior(targetid), PlayerInfo[targetid][Maths]);
    strcat(fstr, str);
    format(str, sizeof(str), "{F2C80C}TP Status: {3DE3B1}%s {FFFFFF}| {F2C80C}YG Status: {3DE3B1}%s{FFFFFF} | {F2C80C}Virtual World: {3DE3B1}%d{FFFFFF},\n", PlayerInfo[targetid][Trusted] ? ("Yes") : ("No"), PlayerInfo[targetid][YG] ? ("Yes") : ("No"), GetPlayerVirtualWorld(targetid));
    strcat(fstr, str);
    format(str, sizeof(str), "{F2C80C}Cookies: {3DE3B1}%d {FFFFFF} | {F2C80C}Cakes: {3DE3B1}%d{FFFFFF} | {F2C80C}Scores:{3DE3B1} %d{FFFFFF} | {F2C80C}Ping:{3DE3B1} %d{FFFFFF},\n", PlayerInfo[targetid][Cookies], PlayerInfo[targetid][Cakes], GetPlayerScore(targetid), GetPlayerPing(targetid));
    strcat(fstr, str);
    format(str, sizeof(str), "{F2C80C}Money:{3DE3B1} $%d{FFFFFF} | {F2C80C}Bank:{3DE3B1} $%d{FFFFFF} | {F2C80C}Logged In:{3DE3B1} %s{FFFFFF} | {F2C80C}Registered:{3DE3B1} %s{FFFFFF},\n", GetPlayerMoney(targetid), PlayerInfo[targetid][bank], PlayerInfo[targetid][LoggedIn] ? ("Yes") : ("No"), PlayerInfo[targetid][Registered] ? ("Yes") : ("No"));
    strcat(fstr, str);
    format(str, sizeof(str), "{F2C80C}Kills:{3DE3B1} %d{FFFFFF} | {F2C80C}Deaths:{3DE3B1} %d{FFFFFF} | {F2C80C}K/D Ratio:{3DE3B1} %0.2f{FFFFFF} | {F2C80C}AdminKills: {3DE3B1}%d{FFFFFF},\n", PlayerInfo[targetid][Kills], PlayerInfo[targetid][Deaths], (PlayerInfo[targetid][Kills] / pDeaths), PlayerInfo[targetid][AdminKills]);
    strcat(fstr, str);
    format(str, sizeof(str), "{F2C80C}Playing Since: {3DE3B1}%d {F2C80C}Hours {FFFFFF}| {3DE3B1}%d {F2C80C}Mins {FFFFFF}| {3DE3B1}%d{F2C80C} Secs {FFFFFF}| {F2C80C}Skin:{3DE3B1} %d{FFFFFF}.\n", h, m, s, GetPlayerSkin(targetid));
    strcat(fstr, str);
    ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, "Player Stats", fstr, "OK", "");
    return 1;
}
About the /ban , /rban

went i /ban some one i banned my self....


and my /stats i preass /stats is say The Player IS Not Connected


and i only can use stats /stats [id]


the /ban 1 test then i ban my self + that player


the /rban = SAme


help me fix it please
Reply
#2

I think you need to change
pawn Код:
return SetTimerEx("BanTimer", 200, false, "is", targetid, reason);
also with Rban
I don't understand with stats, what you mean to say.
Reply
#3

what stats won't work went i preass /stats is won't show my stats is said Player Is Not Connected

and only work with /stats [id]
Reply
#4

You should try it for your /stats command:

pawn Код:
CMD:stats(playerid,params[])
{
    new targetid;

    if (sscanf(params, "u", targetid)) targetid = playerid; // If you just use /stats without [id], the target is playerid
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Player Not Connected!");

    // ...
}
Reply
#5

Nevermind. Look above me.
Reply
#6

what about this sscanf(params, "U(-1)", targetid); ?
Reply
#7

Delete it. It don't needed anymore.
Reply
#8

thanks everyone
Reply
#9

<DELETE>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)