[Ajuda] Ajuda /setvip
#1

Gente eu seto o vip mais nгo salva o level de vip o que tem de errado ??
PHP код:
CMD:setvip(playeridparams[])
{
    new 
file[100];
    
format(file,sizeof(file),PastaVip,Pinfo[playerid][pName]);
    new 
string[128],string2[128];
    new 
giveplayeridlevel;
    new 
playername[MAX_PLAYER_NAME],idname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
GetPlayerName(playerid,idname,MAX_PLAYER_NAME);
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_RED"Tem que estar logado na rcon!");
    if(
sscanf(params"ud"giveplayeridlevel))return SendClientMessage(playeridCOLOR_RED"Use: /setvip [Playerid/Partname] [Level]");
    else if (
giveplayerid == INVALID_PLAYER_ID)return SendClientMessage(playeridCOLOR_RED"Player nгo conectado");
    else if (
level 3)return SendClientMessage(playeridCOLOR_RED"Maximo de level vip й 3");
    else {
        
Pinfo[giveplayerid][Vip_Level] = level;
        
format(string,sizeof(string),"Administrador %s setou seu level de vip para %d",playername,level);
        
SendClientMessage(giveplayerid,COLOR_YELLOW,string);
        
format(string2,sizeof(string2),"%s Nнvel de Vip й %d",idname,level);
        
SendClientMessageToAll(COLOR_YELLOW,string2);
        
DOF2_SetInt(file,"Vip_Level",Pinfo[playerid][Vip_Level]);
    }
    return 
1;

CODE Completo:
PHP код:

#include <a_samp>
#include <dof2>
#include <zcmd>
#include <sscanf2>
#define COLOR_GREEN           0x33AA33AA
#define COLOR_RED             0xAA3333AA
#define COLOR_YELLOW          0xFFFF00AA
#define COLOR_LIGHTBLUE       0x33CCFFAA
#define COLOR_ORANGE          0xFF9900AA
#define PastaVip              "VIP/%s.ini"
enum PLAYER_MAIN
{
    
pName[MAX_PLAYER_NAME],
    
Pip[16],
    
Vip_Level
}
new 
Pinfo[MAX_PLAYERS][PLAYER_MAIN];
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),PastaVip,Name);
    if(!
DOF2_FileExists(file)) {
        
DOF2_CreateFile(file);
        
DOF2_SetString(file,"Name",Name);
        
DOF2_SetString(file,"Ip",Ip);
        
DOF2_SetInt(file,"Vip_Level",0);
    }
    
Pinfo[playerid][Vip_Level] = DOF2_GetInt(file,"Vip_Level");
    return 
1;
}
public 
OnGameModeExit()
{
    
DOF2_Exit();
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
file[100];
    
format(file,sizeof(file),PastaVip,Pinfo[playerid][pName]);
    
DOF2_SetString(file,"Name",Pinfo[playerid][pName]);
    
DOF2_SetString(file,"Ip",Pinfo[playerid][Pip]);
    
DOF2_SetInt(file,"Vip_Level",Pinfo[playerid][Vip_Level]);
    
Pinfo[playerid][Vip_Level]  = 0;
    return 
1;
}
CMD:setvip(playeridparams[])
{
    new 
file[100];
    
format(file,sizeof(file),PastaVip,Pinfo[playerid][pName]);
    new 
string[128],string2[128];
    new 
giveplayeridlevel;
    new 
playername[MAX_PLAYER_NAME],idname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
GetPlayerName(playerid,idname,MAX_PLAYER_NAME);
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_RED"Tem que estar logado na rcon!");
    if(
sscanf(params"ud"giveplayeridlevel))return SendClientMessage(playeridCOLOR_RED"Use: /setvip [Playerid] [Level]");
    else if (
giveplayerid == INVALID_PLAYER_ID)return SendClientMessage(playeridCOLOR_RED"Player nгo conectado");
    else if (
level 3)return SendClientMessage(playeridCOLOR_RED"Maximo de level vip й 3");
    else {
        
Pinfo[giveplayerid][Vip_Level] = level;
        
format(string,sizeof(string),"Administrador %s setou seu level de vip para %d",playername,level);
        
SendClientMessage(giveplayerid,COLOR_YELLOW,string);
        
format(string2,sizeof(string2),"%s Nнvel de Vip й %d",idname,level);
        
SendClientMessageToAll(COLOR_YELLOW,string2);
        
DOF2_SetInt(file,"Vip_Level",Pinfo[playerid][Vip_Level]);
    }
    return 
1;
}
CMD:viplevel(playerid)
{
    new 
string1[128],string2[128],string3[128];
    
format(string1,sizeof(string1),"============================");
    
format(string2,sizeof(string2),"Seu nнvel V.I.P й %d",Pinfo[playerid][Vip_Level]);
    
format(string3,sizeof(string3),"============================");
    
SendClientMessage(playerid,COLOR_YELLOW,string1);
    
SendClientMessage(playerid,COLOR_YELLOW,string2);
    
SendClientMessage(playerid,COLOR_YELLOW,string3);
    return 
1;

Reply
#2

DOF2_SaveFile(); tenta ae
Reply
#3

Funfou nгo :S
Reply
#4

coloca pra carregar na public OnPlayerConnect(playerid) uй
Reply
#5

onde se pois? pois, ai no seu comando e na salvaзao, estб apenas setando e nao tha salvando nada, dificilmente vai funcionar..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)