SA-MP Forums Archive
The Base VIP system - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: The Base VIP system (/showthread.php?tid=206335)



The Base VIP system - Mr.Jvxmc - 03.01.2011

The system don't save player status

pawn Код:
public OnPlayerConnect(playerid)
{
    new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);
    if(!dini_Exists(file)) {
        dini_Create(file);
        dini_Set(file,"Name",Name);
        dini_Set(file,"Ip",Ip);
        dini_IntSet(file,"Vip_Level",0);
    }
    Pinfo[playerid][Vip_Level] = dini_Int(file,"Vip_Level");
    return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new file[100];
    format(file,sizeof(file),PlayerFile,Pinfo[playerid][pName]);
    dini_Set(file,"Name",Pinfo[playerid][pName]);
    dini_Set(file,"Ip",Pinfo[playerid][Pip]);
    dini_IntSet(file,"Vip_Level",Pinfo[playerid][Vip_Level]);
    Pinfo[playerid][Vip_Level]  = 0;
    return 1;
}
The Command
pawn Код:
dcmd_setvip(playerid, params[])
{
    new file[100];
    format(file,sizeof(file),PlayerFile,Pinfo[playerid][pName]);
    new string[128],string2[128];
    new giveplayerid, level;
    new playername[MAX_PLAYER_NAME],idname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
    GetPlayerName(playerid,idname,MAX_PLAYER_NAME);
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Have To Be Rcon Admin To Use This Command!");
    if(sscanf(params, "ud", giveplayerid, level))return SendClientMessage(playerid, COLOR_RED, "Usage: /setvip (playerid/id) (level)");
    else if (giveplayerid == INVALID_PLAYER_ID)return SendClientMessage(playerid, COLOR_RED, "Player Is Not Connected");
    else if (level > 3)return SendClientMessage(playerid, COLOR_RED, "Maximum Vip Level Is 3");
    else
    {
        Pinfo[giveplayerid][Vip_Level] = level;
        format(string,sizeof(string),"Administrator %s Set Your Vip Level To %d", playername, level);
        SendClientMessage(giveplayerid,COLOR_YELLOW,string);
        format(string2,sizeof(string2),"%s's V.I.P level is now %d", playername, level);
        SendClientMessageToAll(COLOR_YELLOW,string2);
        dini_IntSet(file,"Vip_Level",Pinfo[playerid][Vip_Level]);
    }
    return 1;
}
I make me In-Game a vip member, then i log off, but that isin't save player(s) status, why ?


Original is here


Re: The Base VIP system - Universal - 03.01.2011

The define u made "PlayerFile" does not work properly, i think so. Could you show it?


Re: The Base VIP system - Mr.Jvxmc - 03.01.2011

Quote:
Originally Posted by Universal
Посмотреть сообщение
The define u made "PlayerFile" does not work properly, i think so. Could you show it?
here it is:

pawn Код:
#define PlayerFile              "VIP/%s.ini"



Re: The Base VIP system - Mr.Jvxmc - 03.01.2011

Does someone know's what is the problem?