Unkown command as soon I use params!
#3

pawn Код:
#define PATH "mainfs/%s.ini"

new Kills[MAX_PLAYERS], Deaths[MAX_PLAYERS], DerbyWon[MAX_PLAYERS], DuelWon[MAX_PLAYERS], DuelsAllow[MAX_PLAYERS];

stock UserPath(playerid)
{
    new file[40];
    format(file, sizeof(file), PATH, GetName(playerid));
    return file;
}

stock GetName(playerid)
{
    new Name[24];
    GetPlayerName(playerid, Name, sizeof(Name));
    return Name;
}

public OnPlayerConnect(playerid)
{
    new string[40];
    format(string, sizeof(string), "JLadmin/Users/%s.ini", GetName(playerid));
    if(fexist(string))
    {
        if(!fexist(UserPath(playerid)))
        {
            new INI:File = INI_Open(UserPath(playerid));
            INI_WriteInt(File, "Kills", 0);
            INI_WriteInt(File, "Deaths", 0);
            INI_WriteInt(File, "Derby Won", 0);
            INI_WriteInt(File, "DuelWon", 0);
            INI_WriteInt(File, "DuelsAllow", 0);
            INI_Close(File);
            SetTimerEx("SaveData", 1000, 1, "i", playerid);
        }
        else
        {
            INI_ParseFile(UserPath(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
        }
    }
}

stock SavePlayerData(playerid)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_WriteInt(File, "Kills", Kills[playerid]);
    INI_WriteInt(File, "Deaths", Deaths[playerid]);
    INI_WriteInt(File, "DerbyWon", DerbyWon[playerid]);
    INI_WriteInt(File, "DuelWon", DuelWon[playerid]);
    INI_WriteInt(File, "DuelsAllow", DuelsAllow[playerid]);
    INI_Close(File);
    return 1;
}

forward loadaccount_user(playerid, name[], value[]);
public loadaccount_user(playerid, name[], value[])
{
    INI_Int("Kills", Kills[playerid]);
    INI_Int("Deaths", Deaths[playerid]);
    INI_Int("Derby Won", DerbyWon[playerid]);
    INI_Int("DuelWon", DuelWon[playerid]);
    INI_Int("DuelsAllow", DuelsAllow[playerid]);
    return 1;
}

CMD:pstats(playerid, params[])
{
    new id;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1,"{ff0000}Error: {ffffff}Correct usage: /stats (playerid)");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{ff0000}Error: {ffffff}Player Is Not Connected");
    new string[201];
    format(string, sizeof(string), "{f7ea00}~~~~~~~~%s(%d)~~~~~~~ \n {ff0000}Kills: {00ff19}%d \n {ff0000}Deaths: {00ff19}%d \n {ff0000}Death Racing Won: {00ff19}%d \n {ff0000}Duels Won: {00ff19}%d \n {ff0000}Kill/Death Ratio: {00ff19}%d", GetName(id), id, Kills[id], Deaths[id], DerbyWon[id], DuelWon[id], Kills[id]/Deaths[id]);
    ShowPlayerDialog(playerid, 25, DIALOG_STYLE_MSGBOX, "{f7ea00}Player Statistics:", string, "Okay", "");
    return 1;
}
Reply


Messages In This Thread
Unkown command as soon I use params! - by PMH - 30.08.2014, 17:20
Re: Unkown command as soon I use params! - by kloning1 - 30.08.2014, 17:23
Re: Unkown command as soon I use params! - by PMH - 30.08.2014, 17:28
Re: Unkown command as soon I use params! - by ThePhenix - 30.08.2014, 17:32
Re: Unkown command as soon I use params! - by PMH - 30.08.2014, 17:36
Re: Unkown command as soon I use params! - by ThePhenix - 30.08.2014, 17:38
Re: Unkown command as soon I use params! - by PMH - 30.08.2014, 17:40
Re: Unkown command as soon I use params! - by M0HAMMAD - 30.08.2014, 19:30
Re: Unkown command as soon I use params! - by ThePhenix - 30.08.2014, 19:34

Forum Jump:


Users browsing this thread: 1 Guest(s)