Add Saving Admin Lvl+Vip in Dini
#1

hi , this is the registration code with dini and commands with zcmd of course :
pawn Code:
// [FS] torran's Registration System v3
// Made by Joe Torran C
// DO NOT REMOVE THESE CREDITS

#include <a_samp>
#include <dini>
#include <dudb>
#include <zcmd>

#define SCRIPT_VERSION          "v3"

#define colorRed                0xFF0000FF
#define colorGreen              0x008000FF

#define DIALOG_REGISTER         1
#define DIALOG_LOGIN            2
#define DIALOG_ACCOUNT          3
#define DIALOG_CHANGEPASS       4
#define DIALOG_VIEWSTATS        6
#define DIALOG_CHECKSTATS       7

#pragma unused                  ret_memcpy
#pragma unused                  strtok

forward UpdateTime(playerid);

new str[128];
new file[128];
new playerIP[16];

new Update;

public OnPlayerConnect(playerid)
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    GetPlayerIp(playerid, playerIP, 16);
   
    TogglePlayerSpectating(playerid, 1);

    if(!dini_Exists(file))
    {
        format(str, 128, "Welcome %s \n\nPlease register your account", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Account Management", str, "Register", "Quit");
    }
    else
    {
    format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
    }
   
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    if(GetPVarInt(playerid, "Logged") == 1)
    {
        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
        dini_IntSet(file, "Score", GetPlayerScore(playerid));
        dini_IntSet(file, "Kills", GetPVarInt(playerid, "Kills"));
        dini_IntSet(file, "Deaths", GetPVarInt(playerid, "Deaths"));
        dini_IntSet(file, "Minutes Ingame", GetPVarInt(playerid, "Time"));

        KillTimer(Update);
    }
    return 1;
}

public OnFilterScriptInit()
{
    printf("\n  [FS] torran's Registration System %s \n", SCRIPT_VERSION);
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    if(dialogid == DIALOG_REGISTER)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(strlen(inputtext) == 0)
            {
                format(str, 128, "Welcome %s \n\nPlease register your account", GetName(playerid));
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Account Management", str, "Register", "Quit");
                return 0;
            }
            if(!dini_Exists(file))
            {
                dini_Create(file);
                dini_IntSet(file, "Password", udb_hash(inputtext));
                dini_IntSet(file, "Money", GetPlayerMoney(playerid));
                dini_IntSet(file, "Score", GetPlayerScore(playerid));
                dini_IntSet(file, "Kills", GetPVarInt(playerid, "Kills"));
                dini_IntSet(file, "Deaths", GetPVarInt(playerid, "Deaths"));
                dini_IntSet(file, "Minutes Ingame", GetPVarInt(playerid, "Time"));

                format(str, 128, "Account successfully Registered \n\n\nWelcome %s \n\nPlease login to your account", GetName(playerid));
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
            }
        }
    }
    if(dialogid == DIALOG_LOGIN)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(strlen(inputtext) == 0)
            {
                format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
                return 0;
            }
            if(fexist(file))
            {
                new password = dini_Int(file, "Password");
                if(udb_hash(inputtext) != password)
                {
                    if(GetPVarInt(playerid, "Attempts") == 0)
                    {
                        SetPVarInt(playerid, "Attempts", 1);
                        SendClientMessage(playerid, colorRed, "Incorrect password, You have 1 more attempt");

                        format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
                        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
                    }
                    else if(GetPVarInt(playerid, "Attempts") == 1)
                    {
                        SendClientMessage(playerid, colorRed, "Incorrect password, You do not have any attempts left");
                        Kick(playerid);
                    }
                }
                else
                {
                    SetPVarInt(playerid, "Logged", 1);

                    SetPlayerCash(playerid, dini_Int(file, "Money"));
                    SetPlayerScore(playerid, dini_Int(file, "Score"));
                    SetPVarInt(playerid, "Kills", dini_Int(file, "Kills"));
                    SetPVarInt(playerid, "Deaths", dini_Int(file, "Deaths"));
                    SetPVarInt(playerid, "Time", dini_Int(file, "Minutes Ingame"));

                    GetPlayerIp(playerid, playerIP, 16);
                    dini_Set(file, "IP", playerIP);

                    Update = SetTimerEx("UpdateTime", 60*1000, 1, "i", playerid);

                    TogglePlayerSpectating(playerid, 0);

                    SendClientMessage(playerid, colorGreen, "You have successfully logged in.");
                }
            }
        }
    }
    if(dialogid == DIALOG_CHANGEPASS)
    {
        if(response)
        {
            if(GetPVarInt(playerid, "PassStage") == 1)
            {
                new password = dini_Int(file, "Password");
                if(udb_hash(inputtext) == password)
                {
                    SetPVarInt(playerid, "PassStage", 2);
                    ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_INPUT, "Account Management", "Please input your new password", "Change Pass", "Cancel");
                }
                else
                {
                    SendClientMessage(playerid, colorRed, "Incorrect password.");
                }
            }
            else if(GetPVarInt(playerid, "PassStage") == 2)
            {
                if(GetPVarInt(playerid, "Logged") == 1)
                {
                    dini_IntSet(file, "Password", udb_hash(inputtext));
                    SendClientMessage(playerid, colorGreen, "Password successfully changed.");
                }
            }
        }
    }
   
    return 0;
}

public UpdateTime(playerid)
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    SetPVarInt(playerid, "Time", GetPVarInt(playerid, "Time")+1);
    return 1;
}

CMD:changepass(playerid, params[])
{
    if(GetPVarInt(playerid, "Logged") == 1)
    {
        SetPVarInt(playerid, "PassStage", 1);
        ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_INPUT, "Account Management", "Please input your current password for verification", "Continue", "Cancel");
    }
    return 1;
}


CMD:viewstats(playerid, params[])
{
    if(GetPVarInt(playerid, "Logged") == 1)
    {
        new Float:health; GetPlayerHealth(playerid, health);
        new Float:armour; GetPlayerArmour(playerid, armour);
       
        format(str, 128, "Name: %s\nHealth: %0.00f\nArmour: %0.00f\nMoney: %i\nScore: %i\nKills: %i\nDeaths: %i", GetName(playerid), health, armour, GetPlayerMoney(playerid), GetPlayerScore(playerid), GetPVarInt(playerid, "Kills"), GetPVarInt(playerid, "Deaths"));
        ShowPlayerDialog(playerid, DIALOG_VIEWSTATS, DIALOG_STYLE_MSGBOX, "Account Management", str, "Ok", "Cancel");
    }
    return 1;
}

CMD:checkstats(playerid, params[])
{
    new targetid;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, colorRed, "You need to be an RCON Admin to use this command.");
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, colorRed, "Usage: /checkstats [PlayerID/PartOfName]");
    if(targetid == playerid) return SendClientMessage(playerid, colorRed, "You are trying to view the stats of you, To do this type: /viewstats");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, colorRed, "Player not Found");
   
    if(GetPVarInt(playerid, "Logged") == 1)
    {
        new Float:health; GetPlayerHealth(targetid, health);
        new Float:armour; GetPlayerArmour(targetid, armour);

        format(str, 128, "Name: %s\nHealth: %0.00f\nArmour: %0.00f\nMoney: %i\nScore: %i\nKills: %i\nDeaths: %i", GetName(targetid), health, armour, GetPlayerMoney(targetid), GetPlayerScore(targetid), GetPVarInt(targetid, "Kills"), GetPVarInt(targetid, "Deaths"));
        ShowPlayerDialog(playerid, DIALOG_VIEWSTATS, DIALOG_STYLE_MSGBOX, "Account Management", str, "Ok", "Cancel");
    }
    return 1;
}

stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof name);
    return name;
}

stock SetPlayerCash(playerid, amount)
{
    ResetPlayerMoney(playerid);
    return GivePlayerMoney(playerid, amount);
}

stock sscanf(string[], format[], {Float,_}:...)
{
    #if defined isnull
        if (isnull(string))
    #else
        if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
    #endif
        {
            return format[0];
        }
    #pragma tabsize 4
    new
        formatPos = 0,
        stringPos = 0,
        paramPos = 2,
        paramCount = numargs(),
        delim = ' ';
    while (string[stringPos] && string[stringPos] <= ' ')
    {
        stringPos++;
    }
    while (paramPos < paramCount && string[stringPos])
    {
        switch (format[formatPos++])
        {
            case '\0':
            {
                return 0;
            }
            case 'i', 'd':
            {
                new
                    neg = 1,
                    num = 0,
                    ch = string[stringPos];
                if (ch == '-')
                {
                    neg = -1;
                    ch = string[++stringPos];
                }
                do
                {
                    stringPos++;
                    if ('0' <= ch <= '9')
                    {
                        num = (num * 10) + (ch - '0');
                    }
                    else
                    {
                        return -1;
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num * neg);
            }
            case 'h', 'x':
            {
                new
                    num = 0,
                    ch = string[stringPos];
                do
                {
                    stringPos++;
                    switch (ch)
                    {
                        case 'x', 'X':
                        {
                            num = 0;
                            continue;
                        }
                        case '0' .. '9':
                        {
                            num = (num << 4) | (ch - '0');
                        }
                        case 'a' .. 'f':
                        {
                            num = (num << 4) | (ch - ('a' - 10));
                        }
                        case 'A' .. 'F':
                        {
                            num = (num << 4) | (ch - ('A' - 10));
                        }
                        default:
                        {
                            return -1;
                        }
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num);
            }
            case 'c':
            {
                setarg(paramPos, 0, string[stringPos++]);
            }
            case 'f':
            {

                new changestr[16], changepos = 0, strpos = stringPos;
                while(changepos < 16 && string[strpos] && string[strpos] != delim)
                {
                    changestr[changepos++] = string[strpos++];
                    }
                changestr[changepos] = '\0';
                setarg(paramPos,0,_:floatstr(changestr));
            }
            case 'p':
            {
                delim = format[formatPos++];
                continue;
            }
            case '\'':
            {
                new
                    end = formatPos - 1,
                    ch;
                while ((ch = format[++end]) && ch != '\'') {}
                if (!ch)
                {
                    return -1;
                }
                format[end] = '\0';
                if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
                {
                    if (format[end + 1])
                    {
                        return -1;
                    }
                    return 0;
                }
                format[end] = '\'';
                stringPos = ch + (end - formatPos);
                formatPos = end + 1;
            }
            case 'u':
            {
                new
                    end = stringPos - 1,
                    id = 0,
                    bool:num = true,
                    ch;
                while ((ch = string[++end]) && ch != delim)
                {
                    if (num)
                    {
                        if ('0' <= ch <= '9')
                        {
                            id = (id * 10) + (ch - '0');
                        }
                        else
                        {
                            num = false;
                        }
                    }
                }
                if (num && IsPlayerConnected(id))
                {
                    setarg(paramPos, 0, id);
                }
                else
                {
                    #if !defined foreach
                        #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
                        #define __SSCANF_FOREACH__
                    #endif
                    string[end] = '\0';
                    num = false;
                    new
                        name[MAX_PLAYER_NAME];
                    id = end - stringPos;
                    foreach (Player, playerid)
                    {
                        GetPlayerName(playerid, name, sizeof (name));
                        if (!strcmp(name, string[stringPos], true, id))
                        {
                            setarg(paramPos, 0, playerid);
                            num = true;
                            break;
                        }
                    }
                    if (!num)
                    {
                        setarg(paramPos, 0, INVALID_PLAYER_ID);
                    }
                    string[end] = ch;
                    #if defined __SSCANF_FOREACH__
                        #undef foreach
                        #undef __SSCANF_FOREACH__
                    #endif
                }
                stringPos = end;
            }
            case 's', 'z':
            {
                new
                    i = 0,
                    ch;
                if (format[formatPos])
                {
                    while ((ch = string[stringPos++]) && ch != delim)
                    {
                        setarg(paramPos, i++, ch);
                    }
                    if (!i)
                    {
                        return -1;
                    }
                }
                else
                {
                    while ((ch = string[stringPos++]))
                    {
                        setarg(paramPos, i++, ch);
                    }
                }
                stringPos--;
                setarg(paramPos, i, '\0');
            }
            default:
            {
                continue;
            }
        }
        while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
        {
            stringPos++;
        }
        while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
        {
            stringPos++;
        }
        paramPos++;
    }
    do
    {
        if ((delim = format[formatPos++]) > ' ')
        {
            if (delim == '\'')
            {
                while ((delim = format[formatPos++]) && delim != '\'') {}
            }
            else if (delim != 'z')
            {
                return delim;
            }
        }
    }
    while (delim > ' ');
    return 0;
}
as you can see , it saves score+pass+Kills+death+time IG+money+IP
so iif someone can create for me a Code and place it in the script to save (AdminLevel+VIP)
Reply
#2

if you do not understand, i want only if player register save also VIP and Adminlevel

I'm waiting for your replys
Reply
#3

Where are enums to save VIP, admin level and etc?

Create enums!
Reply
#4

what is "enums" ?
please help me to save VIP+admin level..
Reply
#5

here :
pawn Code:
// By xkirill
// im taking his credit! hehehe >:D

#include <a_samp>
#include <dini>
#include <dudb>
#include <zcmd>

#define SCRIPT_VERSION          "v3"

#define colorRed                0xFF0000FF
#define colorGreen              0x008000FF

#define DIALOG_REGISTER         1
#define DIALOG_LOGIN            2
#define DIALOG_ACCOUNT          3
#define DIALOG_CHANGEPASS       4
#define DIALOG_VIEWSTATS        6
#define DIALOG_CHECKSTATS       7

#pragma unused                  ret_memcpy
#pragma unused                  strtok

forward UpdateTime(playerid);

new str[128];
new file[128];
new playerIP[16];

new Update;

public OnPlayerConnect(playerid)
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    GetPlayerIp(playerid, playerIP, 16);
   
    TogglePlayerSpectating(playerid, 1);

    if(!dini_Exists(file))
    {
        format(str, 128, "Welcome %s \n\nPlease register your account", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Account Management", str, "Register", "Quit");
    }
    else
    {
    format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
    }
   
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    if(GetPVarInt(playerid, "Logged") == 1)
    {
        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
        dini_IntSet(file, "Score", GetPlayerScore(playerid));
        dini_IntSet(file, "Kills", GetPVarInt(playerid, "Kills"));
        dini_IntSet(file, "Deaths", GetPVarInt(playerid, "Deaths"));
        dini_IntSet(file, "Minutes Ingame", GetPVarInt(playerid, "Time"));
        dini_IntSet(file, "Adminlvl",GetPVarInt(playerid, "Admin"));             // new
        dini_IntSet(file, "VIPlvl",GetPVarInt(playerid, "VIP"));             // new
        KillTimer(Update);
    }
    return 1;
}

public OnFilterScriptInit()
{
    printf("\n  [FS] torran's Registration System %s \n", SCRIPT_VERSION);
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    if(dialogid == DIALOG_REGISTER)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(strlen(inputtext) == 0)
            {
                format(str, 128, "Welcome %s \n\nPlease register your account", GetName(playerid));
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Account Management", str, "Register", "Quit");
                return 0;
            }
            if(!dini_Exists(file))
            {
                dini_Create(file);
                dini_IntSet(file, "Password", udb_hash(inputtext));
                dini_IntSet(file, "Money", GetPlayerMoney(playerid));
                dini_IntSet(file, "Score", GetPlayerScore(playerid));
                dini_IntSet(file, "Kills", GetPVarInt(playerid, "Kills"));
                dini_IntSet(file, "Deaths", GetPVarInt(playerid, "Deaths"));
                dini_IntSet(file, "Minutes Ingame", GetPVarInt(playerid, "Time"));
                dini_IntSet(file, "Adminlvl",GetPVarInt(playerid, "Admin"));             // new
                dini_IntSet(file, "VIPlvl",GetPVarInt(playerid, "VIP"));             // new

                format(str, 128, "Account successfully Registered \n\n\nWelcome %s \n\nPlease login to your account", GetName(playerid));
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
            }
        }
    }
    if(dialogid == DIALOG_LOGIN)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(strlen(inputtext) == 0)
            {
                format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
                return 0;
            }
            if(fexist(file))
            {
                new password = dini_Int(file, "Password");
                if(udb_hash(inputtext) != password)
                {
                    if(GetPVarInt(playerid, "Attempts") == 0)
                    {
                        SetPVarInt(playerid, "Attempts", 1);
                        SendClientMessage(playerid, colorRed, "Incorrect password, You have 1 more attempt");

                        format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
                        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
                    }
                    else if(GetPVarInt(playerid, "Attempts") == 1)
                    {
                        SendClientMessage(playerid, colorRed, "Incorrect password, You do not have any attempts left");
                        Kick(playerid);
                    }
                }
                else
                {
                    SetPVarInt(playerid, "Logged", 1);

                    SetPlayerCash(playerid, dini_Int(file, "Money"));
                    SetPlayerScore(playerid, dini_Int(file, "Score"));
                    SetPVarInt(playerid, "Kills", dini_Int(file, "Kills"));
                    SetPVarInt(playerid, "Deaths", dini_Int(file, "Deaths"));
                    SetPVarInt(playerid, "Time", dini_Int(file, "Minutes Ingame"));
                    SetPVarInt(playerid, "Admin", dini_Int(file, "Admin"));             // new
                    SetPVarInt(playerid, "VIP", dini_Int(file, "VIP"));                  // new                              

                    GetPlayerIp(playerid, playerIP, 16);
                    dini_Set(file, "IP", playerIP);

                    Update = SetTimerEx("UpdateTime", 60*1000, 1, "i", playerid);

                    TogglePlayerSpectating(playerid, 0);

                    SendClientMessage(playerid, colorGreen, "You have successfully logged in.");
                }
            }
        }
    }
    if(dialogid == DIALOG_CHANGEPASS)
    {
        if(response)
        {
            if(GetPVarInt(playerid, "PassStage") == 1)
            {
                new password = dini_Int(file, "Password");
                if(udb_hash(inputtext) == password)
                {
                    SetPVarInt(playerid, "PassStage", 2);
                    ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_INPUT, "Account Management", "Please input your new password", "Change Pass", "Cancel");
                }
                else
                {
                    SendClientMessage(playerid, colorRed, "Incorrect password.");
                }
            }
            else if(GetPVarInt(playerid, "PassStage") == 2)
            {
                if(GetPVarInt(playerid, "Logged") == 1)
                {
                    dini_IntSet(file, "Password", udb_hash(inputtext));
                    SendClientMessage(playerid, colorGreen, "Password successfully changed.");
                }
            }
        }
    }
   
    return 0;
}

public UpdateTime(playerid)
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    SetPVarInt(playerid, "Time", GetPVarInt(playerid, "Time")+1);
    return 1;
}

CMD:changepass(playerid, params[])
{
    if(GetPVarInt(playerid, "Logged") == 1)
    {
        SetPVarInt(playerid, "PassStage", 1);
        ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_INPUT, "Account Management", "Please input your current password for verification", "Continue", "Cancel");
    }
    return 1;
}


CMD:viewstats(playerid, params[])
{
    if(GetPVarInt(playerid, "Logged") == 1)
    {
        new Float:health; GetPlayerHealth(playerid, health);
        new Float:armour; GetPlayerArmour(playerid, armour);
       
        format(str, 128, "Name: %s\nHealth: %0.00f\nArmour: %0.00f\nMoney: %i\nScore: %i\nKills: %i\nDeaths: %i", GetName(playerid), health, armour, GetPlayerMoney(playerid), GetPlayerScore(playerid), GetPVarInt(playerid, "Kills"), GetPVarInt(playerid, "Deaths"));
        ShowPlayerDialog(playerid, DIALOG_VIEWSTATS, DIALOG_STYLE_MSGBOX, "Account Management", str, "Ok", "Cancel");
    }
    return 1;
}

CMD:checkstats(playerid, params[])
{
    new targetid;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, colorRed, "You need to be an RCON Admin to use this command.");
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, colorRed, "Usage: /checkstats [PlayerID/PartOfName]");
    if(targetid == playerid) return SendClientMessage(playerid, colorRed, "You are trying to view the stats of you, To do this type: /viewstats");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, colorRed, "Player not Found");
   
    if(GetPVarInt(playerid, "Logged") == 1)
    {
        new Float:health; GetPlayerHealth(targetid, health);
        new Float:armour; GetPlayerArmour(targetid, armour);

        format(str, 128, "Name: %s\nHealth: %0.00f\nArmour: %0.00f\nMoney: %i\nScore: %i\nKills: %i\nDeaths: %i", GetName(targetid), health, armour, GetPlayerMoney(targetid), GetPlayerScore(targetid), GetPVarInt(targetid, "Kills"), GetPVarInt(targetid, "Deaths"));
        ShowPlayerDialog(playerid, DIALOG_VIEWSTATS, DIALOG_STYLE_MSGBOX, "Account Management", str, "Ok", "Cancel");
    }
    return 1;
}

stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof name);
    return name;
}

stock SetPlayerCash(playerid, amount)
{
    ResetPlayerMoney(playerid);
    return GivePlayerMoney(playerid, amount);
}

stock sscanf(string[], format[], {Float,_}:...)
{
    #if defined isnull
        if (isnull(string))
    #else
        if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
    #endif
        {
            return format[0];
        }
    #pragma tabsize 4
    new
        formatPos = 0,
        stringPos = 0,
        paramPos = 2,
        paramCount = numargs(),
        delim = ' ';
    while (string[stringPos] && string[stringPos] <= ' ')
    {
        stringPos++;
    }
    while (paramPos < paramCount && string[stringPos])
    {
        switch (format[formatPos++])
        {
            case '\0':
            {
                return 0;
            }
            case 'i', 'd':
            {
                new
                    neg = 1,
                    num = 0,
                    ch = string[stringPos];
                if (ch == '-')
                {
                    neg = -1;
                    ch = string[++stringPos];
                }
                do
                {
                    stringPos++;
                    if ('0' <= ch <= '9')
                    {
                        num = (num * 10) + (ch - '0');
                    }
                    else
                    {
                        return -1;
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num * neg);
            }
            case 'h', 'x':
            {
                new
                    num = 0,
                    ch = string[stringPos];
                do
                {
                    stringPos++;
                    switch (ch)
                    {
                        case 'x', 'X':
                        {
                            num = 0;
                            continue;
                        }
                        case '0' .. '9':
                        {
                            num = (num << 4) | (ch - '0');
                        }
                        case 'a' .. 'f':
                        {
                            num = (num << 4) | (ch - ('a' - 10));
                        }
                        case 'A' .. 'F':
                        {
                            num = (num << 4) | (ch - ('A' - 10));
                        }
                        default:
                        {
                            return -1;
                        }
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num);
            }
            case 'c':
            {
                setarg(paramPos, 0, string[stringPos++]);
            }
            case 'f':
            {

                new changestr[16], changepos = 0, strpos = stringPos;
                while(changepos < 16 && string[strpos] && string[strpos] != delim)
                {
                    changestr[changepos++] = string[strpos++];
                    }
                changestr[changepos] = '\0';
                setarg(paramPos,0,_:floatstr(changestr));
            }
            case 'p':
            {
                delim = format[formatPos++];
                continue;
            }
            case '\'':
            {
                new
                    end = formatPos - 1,
                    ch;
                while ((ch = format[++end]) && ch != '\'') {}
                if (!ch)
                {
                    return -1;
                }
                format[end] = '\0';
                if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
                {
                    if (format[end + 1])
                    {
                        return -1;
                    }
                    return 0;
                }
                format[end] = '\'';
                stringPos = ch + (end - formatPos);
                formatPos = end + 1;
            }
            case 'u':
            {
                new
                    end = stringPos - 1,
                    id = 0,
                    bool:num = true,
                    ch;
                while ((ch = string[++end]) && ch != delim)
                {
                    if (num)
                    {
                        if ('0' <= ch <= '9')
                        {
                            id = (id * 10) + (ch - '0');
                        }
                        else
                        {
                            num = false;
                        }
                    }
                }
                if (num && IsPlayerConnected(id))
                {
                    setarg(paramPos, 0, id);
                }
                else
                {
                    #if !defined foreach
                        #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
                        #define __SSCANF_FOREACH__
                    #endif
                    string[end] = '\0';
                    num = false;
                    new
                        name[MAX_PLAYER_NAME];
                    id = end - stringPos;
                    foreach (Player, playerid)
                    {
                        GetPlayerName(playerid, name, sizeof (name));
                        if (!strcmp(name, string[stringPos], true, id))
                        {
                            setarg(paramPos, 0, playerid);
                            num = true;
                            break;
                        }
                    }
                    if (!num)
                    {
                        setarg(paramPos, 0, INVALID_PLAYER_ID);
                    }
                    string[end] = ch;
                    #if defined __SSCANF_FOREACH__
                        #undef foreach
                        #undef __SSCANF_FOREACH__
                    #endif
                }
                stringPos = end;
            }
            case 's', 'z':
            {
                new
                    i = 0,
                    ch;
                if (format[formatPos])
                {
                    while ((ch = string[stringPos++]) && ch != delim)
                    {
                        setarg(paramPos, i++, ch);
                    }
                    if (!i)
                    {
                        return -1;
                    }
                }
                else
                {
                    while ((ch = string[stringPos++]))
                    {
                        setarg(paramPos, i++, ch);
                    }
                }
                stringPos--;
                setarg(paramPos, i, '\0');
            }
            default:
            {
                continue;
            }
        }
        while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
        {
            stringPos++;
        }
        while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
        {
            stringPos++;
        }
        paramPos++;
    }
    do
    {
        if ((delim = format[formatPos++]) > ' ')
        {
            if (delim == '\'')
            {
                while ((delim = format[formatPos++]) && delim != '\'') {}
            }
            else if (delim != 'z')
            {
                return delim;
            }
        }
    }
    while (delim > ' ');
    return 0;
}
Reply
#6

Thanx a lot xKirill !!you're amazing!

and i have a question ,
for exemple i want to add /healme for VIP with zcmd OFC,
it will be like this :
pawn Code:
CMD:minigun(playerid, params[])
{
    GivePlayerWeapon(playerid, 38, 200); ///it is a simple exemple//
    }
    return 1;
}
so the player get Minigun... my question is how make Dini check if the player is VIP lvl 3 for an exemple ?
Reply
#7

pawn Code:
if(GetPVarInt(playerid, "VIP") == 3)
Reply
#8

Quote:
Originally Posted by Jafet_Macario
View Post
pawn Code:
if(GetPVarInt(playerid, "VIP") == 3)
full script:
pawn Code:
CMD:minigun(playerid, params[])
{
#pragma unused params // because you dont use params right now :)
    if(GetPVarInt(playerid, "VIP") == 3)
    {
    GivePlayerWeapon(playerid, 38, 200);
    SendClientMessage(playerid, COLOR_LIGHTRED, "You have spawned yourself a minigun!");
    }else{
    SendClientMessage(playerid, COLOR_LIGHTRED, "You need to be Golden VIP to use this command!");
    }
    return 1;
}
Reply
#9

i make my VIPlvl=3 in my ScriptFile and whene i go IG it says :You need to be Golden VIP to use this command!
and whene i go to my Ini file again i found the VIPlvl=0
How to fix it?
Reply
#10

Just make a simple command with ZCMD like: /makevip
Reply
#11

it is not a problem in the FS ? because my value in SF 3 change to 0 and whene i edite it, it do that again ..
and for /makevip i will see my FS to know how to change the Value of VIP ....
Reply
#12

It dont work for me
Reply
#13

There you go:
pawn Code:
CMD:makevip(playerid, params[])
{
    new id, level, sendername[MAX_PLAYER_NAME], string[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, colorRed, "You need to be an RCON admin to use this command");
    if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, colorRed,"USAGE: /makevip [playerid/partofname] [level 1-3]");
    if(value > 3 || value < 0) return SendClientMessage(playerid, colorRed,"Only 1 to 3");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Invalid player ID");
    else
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string),"You have promoted %s to VIP level %d", id, level);
        SendClientMessage(playerid, colorGreen, string);
        format(string, sizeof(string),"You have been promoted to VIP level %d by admin %s", level, id);
        SendClientMessage(id, colorGreen, string);
        SetPVarInt(playerid, "VIP", level);
    }
    return 1;
}
Reply
#14

Quote:
Originally Posted by Jafet_Macario
View Post
There you go:
pawn Code:
CMD:makevip(playerid, params[])
{
    new id, level, sendername[MAX_PLAYER_NAME], string[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, colorRed, "You need to be an RCON admin to use this command");
    if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, colorRed,"USAGE: /makevip [playerid/partofname] [level 1-3]");
    if(value > 3 || value < 0) return SendClientMessage(playerid, colorRed,"Only 1 to 3");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Invalid player ID");
    else
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string),"You have promoted %s to VIP level %d", id, level);
        SendClientMessage(playerid, colorGreen, string);
        format(string, sizeof(string),"You have been promoted to VIP level %d by admin %s", level, id);
        SendClientMessage(id, colorGreen, string);
        SetPVarInt(playerid, "VIP", level);
    }
    return 1;
}
lol.. my version ::
pawn Code:
CMD:setvip(playerid, params[])
{
    if(IsPlayerAdmin(playerid)) {
        new id,
            lvl;
        new name[MAX_PLAYER_NAME];
        new idname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        GetPlayerName(id,idname, sizeof(idname));
        if(sscanf(params,"ui", id, lvl)) {
            GetPVarInt(id, lvl,"VIP");
            new string[64];
            format(string,sizeof(string),"You have successfully changed %s vip lvl to %d",idname,lvl");
                SendClientMessage(playerid,COLOR_GREEN,string);
                format(string,sizeof(string),"
%s has changed your vip level to %d", name, lvl);
                SendClientMessage(playerid,COLOR_GREEN,string);
        }
        else {
            SendClientMessage(playerid, COLOR_LIGHTRED,"
You need to be rcon admin to use this command!");
        }
        return 1;
    }
Reply
#15

thank you a lot !
but there are an error :
Code:
C:\DOCUME~1\mrich\Bureau\alaee\ANEPAS~1\ZOMBIE~1\FILTER~1\t-reg.pwn(250) : error 017: undefined symbol "value"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#16

Quote:
Originally Posted by ServerScripter
View Post
thank you a lot !
but there are an error :
Code:
C:\DOCUME~1\mrich\Bureau\alaee\ANEPAS~1\ZOMBIE~1\FILTER~1\t-reg.pwn(250) : error 017: undefined symbol "value"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
test mine lol
Reply
#17

Ups, my mistake, change:
pawn Code:
if(value > 3 || value < 0)
to:
pawn Code:
if(level > 3 || level < 0)
Reply
#18

i added it it make me now 9 warnings:
Code:
C:\Documents and Settings\mrich\Bureau\alaee\a ne pas supprimer\Zombie Infection\pawno\include\dini.inc(50) : warning 219: local variable "value" shadows a variable at a preceding level
C:\Documents and Settings\mrich\Bureau\alaee\a ne pas supprimer\Zombie Infection\pawno\include\dini.inc(109) : warning 219: local variable "value" shadows a variable at a preceding level
C:\Documents and Settings\mrich\Bureau\alaee\a ne pas supprimer\Zombie Infection\pawno\include\dini.inc(119) : warning 219: local variable "value" shadows a variable at a preceding level
C:\Documents and Settings\mrich\Bureau\alaee\a ne pas supprimer\Zombie Infection\pawno\include\dini.inc(133) : warning 219: local variable "value" shadows a variable at a preceding level
C:\Documents and Settings\mrich\Bureau\alaee\a ne pas supprimer\Zombie Infection\pawno\include\dutils.inc(180) : warning 219: local variable "value" shadows a variable at a preceding level
C:\Documents and Settings\mrich\Bureau\alaee\a ne pas supprimer\Zombie Infection\pawno\include\dutils.inc(190) : warning 219: local variable "value" shadows a variable at a preceding level
C:\Documents and Settings\mrich\Bureau\alaee\a ne pas supprimer\Zombie Infection\pawno\include\dudb.inc(111) : warning 219: local variable "value" shadows a variable at a preceding level
C:\Documents and Settings\mrich\Bureau\alaee\a ne pas supprimer\Zombie Infection\pawno\include\dudb.inc(117) : warning 219: local variable "value" shadows a variable at a preceding level
C:\Documents and Settings\mrich\Bureau\alaee\a ne pas supprimer\Zombie Infection\pawno\include\dudb.inc(123) : warning 219: local variable "value" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


9 Warnings.
And LOL xkirill your code make me than 11 errors
Reply
#19

^^ maybe you changed something,
pawn Code:
CMD:makevip(playerid, params[])
{
    new id, level, sendername[MAX_PLAYER_NAME], string[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, colorRed, "You need to be an RCON admin to use this command");
    if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, colorRed,"USAGE: /makevip [playerid/partofname] [level 1-3]");
    if(level > 3 || level < 0) return SendClientMessage(playerid, colorRed,"Only 1 to 3");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Invalid player ID");
    else
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string),"You have promoted %s to VIP level %d", id, level);
        SendClientMessage(playerid, colorGreen, string);
        format(string, sizeof(string),"You have been promoted to VIP level %d by admin %s", level, id);
        SendClientMessage(id, colorGreen, string);
        SetPVarInt(playerid, "VIP", level);
    }
    return 1;
}
This works perfectly for me.
Reply
#20

Quote:
Originally Posted by Jafet_Macario
View Post
^^ maybe you changed something,
pawn Code:
CMD:makevip(playerid, params[])
{
    new id, level, sendername[MAX_PLAYER_NAME], string[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, colorRed, "You need to be an RCON admin to use this command");
    if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, colorRed,"USAGE: /makevip [playerid/partofname] [level 1-3]");
    if(level > 3 || level < 0) return SendClientMessage(playerid, colorRed,"Only 1 to 3");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Invalid player ID");
    else
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string),"You have promoted %s to VIP level %d", id, level);
        SendClientMessage(playerid, colorGreen, string);
        format(string, sizeof(string),"You have been promoted to VIP level %d by admin %s", level, id);
        SendClientMessage(id, colorGreen, string);
        SetPVarInt(playerid, "VIP", level);
    }
    return 1;
}
This works perfectly for me.
Your Script is working ! thank you for it , but as i sayed, whene i relog it make me VIP 0
this is the full FS see if i wrong something :
pawn Code:
// By xkirill
// im taking his credit! hehehe >:D

#include <a_samp>
#include <dini>
#include <dudb>
#include <zcmd>

#define SCRIPT_VERSION          "v3"

#define colorRed                0xFF0000FF
#define colorGreen              0x008000FF

#define DIALOG_REGISTER         1
#define DIALOG_LOGIN            2
#define DIALOG_ACCOUNT          3
#define DIALOG_CHANGEPASS       4
#define DIALOG_VIEWSTATS        6
#define DIALOG_CHECKSTATS       7

#pragma unused                  ret_memcpy
#pragma unused                  strtok

forward UpdateTime(playerid);

new str[128];
new file[128];
new playerIP[16];
new value;

new Update;

public OnPlayerConnect(playerid)
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    GetPlayerIp(playerid, playerIP, 16);

    TogglePlayerSpectating(playerid, 1);

    if(!dini_Exists(file))
    {
        format(str, 128, "Welcome %s \n\nPlease register your account", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Account Management", str, "Register", "Quit");
    }
    else
    {
    format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
    }

    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    if(GetPVarInt(playerid, "Logged") == 1)
    {
        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
        dini_IntSet(file, "Score", GetPlayerScore(playerid));
        dini_IntSet(file, "Kills", GetPVarInt(playerid, "Kills"));
        dini_IntSet(file, "Deaths", GetPVarInt(playerid, "Deaths"));
        dini_IntSet(file, "Minutes Ingame", GetPVarInt(playerid, "Time"));
        dini_IntSet(file, "Adminlvl",GetPVarInt(playerid, "Admin"));             // new
        dini_IntSet(file, "VIPlvl",GetPVarInt(playerid, "VIP"));             // new
        KillTimer(Update);
    }
    return 1;
}

public OnFilterScriptInit()
{
    printf("\n  [FS] torran's Registration System %s \n", SCRIPT_VERSION);
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    if(dialogid == DIALOG_REGISTER)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(strlen(inputtext) == 0)
            {
                format(str, 128, "Welcome %s \n\nPlease register your account", GetName(playerid));
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Account Management", str, "Register", "Quit");
                return 0;
            }
            if(!dini_Exists(file))
            {
                dini_Create(file);
                dini_IntSet(file, "Password", udb_hash(inputtext));
                dini_IntSet(file, "Money", GetPlayerMoney(playerid));
                dini_IntSet(file, "Score", GetPlayerScore(playerid));
                dini_IntSet(file, "Kills", GetPVarInt(playerid, "Kills"));
                dini_IntSet(file, "Deaths", GetPVarInt(playerid, "Deaths"));
                dini_IntSet(file, "Minutes Ingame", GetPVarInt(playerid, "Time"));
                dini_IntSet(file, "Adminlvl",GetPVarInt(playerid, "Admin"));             // new
                dini_IntSet(file, "VIPlvl",GetPVarInt(playerid, "VIP"));             // new

                format(str, 128, "Account successfully Registered \n\n\nWelcome %s \n\nPlease login to your account", GetName(playerid));
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
            }
        }
    }
    if(dialogid == DIALOG_LOGIN)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(strlen(inputtext) == 0)
            {
                format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
                return 0;
            }
            if(fexist(file))
            {
                new password = dini_Int(file, "Password");
                if(udb_hash(inputtext) != password)
                {
                    if(GetPVarInt(playerid, "Attempts") == 0)
                    {
                        SetPVarInt(playerid, "Attempts", 1);
                        SendClientMessage(playerid, colorRed, "Incorrect password, You have 1 more attempt");

                        format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
                        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
                    }
                    else if(GetPVarInt(playerid, "Attempts") == 1)
                    {
                        SendClientMessage(playerid, colorRed, "Incorrect password, You do not have any attempts left");
                        Kick(playerid);
                    }
                }
                else
                {
                    SetPVarInt(playerid, "Logged", 1);

                    SetPlayerCash(playerid, dini_Int(file, "Money"));
                    SetPlayerScore(playerid, dini_Int(file, "Score"));
                    SetPVarInt(playerid, "Kills", dini_Int(file, "Kills"));
                    SetPVarInt(playerid, "Deaths", dini_Int(file, "Deaths"));
                    SetPVarInt(playerid, "Time", dini_Int(file, "Minutes Ingame"));
                    SetPVarInt(playerid, "Admin", dini_Int(file, "Admin"));             // new
                    SetPVarInt(playerid, "VIP", dini_Int(file, "VIP"));                  // new

                    GetPlayerIp(playerid, playerIP, 16);
                    dini_Set(file, "IP", playerIP);

                    Update = SetTimerEx("UpdateTime", 60*1000, 1, "i", playerid);

                    TogglePlayerSpectating(playerid, 0);

                    SendClientMessage(playerid, colorGreen, "You have successfully logged in.");
                }
            }
        }
    }
    if(dialogid == DIALOG_CHANGEPASS)
    {
        if(response)
        {
            if(GetPVarInt(playerid, "PassStage") == 1)
            {
                new password = dini_Int(file, "Password");
                if(udb_hash(inputtext) == password)
                {
                    SetPVarInt(playerid, "PassStage", 2);
                    ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_INPUT, "Account Management", "Please input your new password", "Change Pass", "Cancel");
                }
                else
                {
                    SendClientMessage(playerid, colorRed, "Incorrect password.");
                }
            }
            else if(GetPVarInt(playerid, "PassStage") == 2)
            {
                if(GetPVarInt(playerid, "Logged") == 1)
                {
                    dini_IntSet(file, "Password", udb_hash(inputtext));
                    SendClientMessage(playerid, colorGreen, "Password successfully changed.");
                }
            }
        }
    }

    return 0;
}

public UpdateTime(playerid)
{
    format(file, 128, "/tReg/%s.ini", GetName(playerid));

    SetPVarInt(playerid, "Time", GetPVarInt(playerid, "Time")+1);
    return 1;
}

CMD:changepass(playerid, params[])
{
    if(GetPVarInt(playerid, "Logged") == 1)
    {
        SetPVarInt(playerid, "PassStage", 1);
        ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_INPUT, "Account Management", "Please input your current password for verification", "Continue", "Cancel");
    }
    return 1;
}


CMD:viewstats(playerid, params[])
{
    if(GetPVarInt(playerid, "Logged") == 1)
    {
        new Float:health; GetPlayerHealth(playerid, health);
        new Float:armour; GetPlayerArmour(playerid, armour);

        format(str, 128, "Name: %s\nHealth: %0.00f\nArmour: %0.00f\nMoney: %i\nScore: %i\nKills: %i\nDeaths: %i", GetName(playerid), health, armour, GetPlayerMoney(playerid), GetPlayerScore(playerid), GetPVarInt(playerid, "Kills"), GetPVarInt(playerid, "Deaths"));
        ShowPlayerDialog(playerid, DIALOG_VIEWSTATS, DIALOG_STYLE_MSGBOX, "Account Management", str, "Ok", "Cancel");
    }
    return 1;
}

CMD:checkstats(playerid, params[])
{
    new targetid;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, colorRed, "You need to be an RCON Admin to use this command.");
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, colorRed, "Usage: /checkstats [PlayerID/PartOfName]");
    if(targetid == playerid) return SendClientMessage(playerid, colorRed, "You are trying to view the stats of you, To do this type: /viewstats");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, colorRed, "Player not Found");

    if(GetPVarInt(playerid, "Logged") == 1)
    {
        new Float:health; GetPlayerHealth(targetid, health);
        new Float:armour; GetPlayerArmour(targetid, armour);

        format(str, 128, "Name: %s\nHealth: %0.00f\nArmour: %0.00f\nMoney: %i\nScore: %i\nKills: %i\nDeaths: %i", GetName(targetid), health, armour, GetPlayerMoney(targetid), GetPlayerScore(targetid), GetPVarInt(targetid, "Kills"), GetPVarInt(targetid, "Deaths"));
        ShowPlayerDialog(playerid, DIALOG_VIEWSTATS, DIALOG_STYLE_MSGBOX, "Account Management", str, "Ok", "Cancel");
    }
    return 1;
}
CMD:makevip(playerid, params[])
{
    new id, level, sendername[MAX_PLAYER_NAME], string[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, colorRed, "You need to be an RCON admin to use this command");
    if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, colorRed,"USAGE: /makevip [playerid/partofname] [level 1-3]");
    if(level > 3 || level < 0) return SendClientMessage(playerid, colorRed,"Only 1 to 3");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Invalid player ID");
    else
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string),"You have promoted %s to VIP level %d", id, level);
        SendClientMessage(playerid, colorGreen, string);
        format(string, sizeof(string),"You have been promoted to VIP level %d by admin %s", level, id);
        SendClientMessage(id, colorGreen, string);
        SetPVarInt(playerid, "VIP", level);
    }
    return 1;
}
///////////////////////////////////////PlatinumVIP////////////
CMD:minigun(playerid, params[])
{
    if(GetPVarInt(playerid, "VIP") == 3)
    {
    GivePlayerWeapon(playerid, 38, 200);
    SendClientMessage(playerid, colorRed, "You have spawned yourself a minigun!");
    }else{
    SendClientMessage(playerid, colorGreen, "You need to be Golden VIP to use this command!");
    }
    return 1;
}
stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof name);
    return name;
}

stock SetPlayerCash(playerid, amount)
{
    ResetPlayerMoney(playerid);
    return GivePlayerMoney(playerid, amount);
}

stock sscanf(string[], format[], {Float,_}:...)
{
    #if defined isnull
        if (isnull(string))
    #else
        if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
    #endif
        {
            return format[0];
        }
    #pragma tabsize 4
    new
        formatPos = 0,
        stringPos = 0,
        paramPos = 2,
        paramCount = numargs(),
        delim = ' ';
    while (string[stringPos] && string[stringPos] <= ' ')
    {
        stringPos++;
    }
    while (paramPos < paramCount && string[stringPos])
    {
        switch (format[formatPos++])
        {
            case '\0':
            {
                return 0;
            }
            case 'i', 'd':
            {
                new
                    neg = 1,
                    num = 0,
                    ch = string[stringPos];
                if (ch == '-')
                {
                    neg = -1;
                    ch = string[++stringPos];
                }
                do
                {
                    stringPos++;
                    if ('0' <= ch <= '9')
                    {
                        num = (num * 10) + (ch - '0');
                    }
                    else
                    {
                        return -1;
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num * neg);
            }
            case 'h', 'x':
            {
                new
                    num = 0,
                    ch = string[stringPos];
                do
                {
                    stringPos++;
                    switch (ch)
                    {
                        case 'x', 'X':
                        {
                            num = 0;
                            continue;
                        }
                        case '0' .. '9':
                        {
                            num = (num << 4) | (ch - '0');
                        }
                        case 'a' .. 'f':
                        {
                            num = (num << 4) | (ch - ('a' - 10));
                        }
                        case 'A' .. 'F':
                        {
                            num = (num << 4) | (ch - ('A' - 10));
                        }
                        default:
                        {
                            return -1;
                        }
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num);
            }
            case 'c':
            {
                setarg(paramPos, 0, string[stringPos++]);
            }
            case 'f':
            {

                new changestr[16], changepos = 0, strpos = stringPos;
                while(changepos < 16 && string[strpos] && string[strpos] != delim)
                {
                    changestr[changepos++] = string[strpos++];
                    }
                changestr[changepos] = '\0';
                setarg(paramPos,0,_:floatstr(changestr));
            }
            case 'p':
            {
                delim = format[formatPos++];
                continue;
            }
            case '\'':
            {
                new
                    end = formatPos - 1,
                    ch;
                while ((ch = format[++end]) && ch != '\'') {}
                if (!ch)
                {
                    return -1;
                }
                format[end] = '\0';
                if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
                {
                    if (format[end + 1])
                    {
                        return -1;
                    }
                    return 0;
                }
                format[end] = '\'';
                stringPos = ch + (end - formatPos);
                formatPos = end + 1;
            }
            case 'u':
            {
                new
                    end = stringPos - 1,
                    id = 0,
                    bool:num = true,
                    ch;
                while ((ch = string[++end]) && ch != delim)
                {
                    if (num)
                    {
                        if ('0' <= ch <= '9')
                        {
                            id = (id * 10) + (ch - '0');
                        }
                        else
                        {
                            num = false;
                        }
                    }
                }
                if (num && IsPlayerConnected(id))
                {
                    setarg(paramPos, 0, id);
                }
                else
                {
                    #if !defined foreach
                        #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
                        #define __SSCANF_FOREACH__
                    #endif
                    string[end] = '\0';
                    num = false;
                    new
                        name[MAX_PLAYER_NAME];
                    id = end - stringPos;
                    foreach (Player, playerid)
                    {
                        GetPlayerName(playerid, name, sizeof (name));
                        if (!strcmp(name, string[stringPos], true, id))
                        {
                            setarg(paramPos, 0, playerid);
                            num = true;
                            break;
                        }
                    }
                    if (!num)
                    {
                        setarg(paramPos, 0, INVALID_PLAYER_ID);
                    }
                    string[end] = ch;
                    #if defined __SSCANF_FOREACH__
                        #undef foreach
                        #undef __SSCANF_FOREACH__
                    #endif
                }
                stringPos = end;
            }
            case 's', 'z':
            {
                new
                    i = 0,
                    ch;
                if (format[formatPos])
                {
                    while ((ch = string[stringPos++]) && ch != delim)
                    {
                        setarg(paramPos, i++, ch);
                    }
                    if (!i)
                    {
                        return -1;
                    }
                }
                else
                {
                    while ((ch = string[stringPos++]))
                    {
                        setarg(paramPos, i++, ch);
                    }
                }
                stringPos--;
                setarg(paramPos, i, '\0');
            }
            default:
            {
                continue;
            }
        }
        while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
        {
            stringPos++;
        }
        while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
        {
            stringPos++;
        }
        paramPos++;
    }
    do
    {
        if ((delim = format[formatPos++]) > ' ')
        {
            if (delim == '\'')
            {
                while ((delim = format[formatPos++]) && delim != '\'') {}
            }
            else if (delim != 'z')
            {
                return delim;
            }
        }
    }
    while (delim > ' ');
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 11 Guest(s)