19.08.2012, 02:48
Gente eu seto o vip mais nгo salva o level de vip o que tem de errado ??
CODE Completo:
PHP код:
CMD:setvip(playerid, params[])
{
new file[100];
format(file,sizeof(file),PastaVip,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, "Tem que estar logado na rcon!");
if(sscanf(params, "ud", giveplayerid, level))return SendClientMessage(playerid, COLOR_RED, "Use: /setvip [Playerid/Partname] [Level]");
else if (giveplayerid == INVALID_PLAYER_ID)return SendClientMessage(playerid, COLOR_RED, "Player nгo conectado");
else if (level > 3)return SendClientMessage(playerid, COLOR_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;
}
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(playerid, reason)
{
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(playerid, params[])
{
new file[100];
format(file,sizeof(file),PastaVip,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, "Tem que estar logado na rcon!");
if(sscanf(params, "ud", giveplayerid, level))return SendClientMessage(playerid, COLOR_RED, "Use: /setvip [Playerid] [Level]");
else if (giveplayerid == INVALID_PLAYER_ID)return SendClientMessage(playerid, COLOR_RED, "Player nгo conectado");
else if (level > 3)return SendClientMessage(playerid, COLOR_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;
}