11.11.2015, 22:35
bom pessoal estou fazendo uma filterscript pro meu sv pq n tenho a pwn dele entгo eu resolvi criar aqui pra salvar o level adm do player e o clan dele porem nгo estб salvando na pasta Contas em scriptfiles eu jб criei a pasta jб puis printf pra indentificar se tem algo de errado mas n tem nada de errado so nгo estб salvando oque eu faзo
codigo
codigo
PHP Code:
// NEW.PWN BY: $C0pAs
//===========================INCLUDES===================================//
#include <a_samp>
#include <ZCMD>
#include <sscanf>
#include <DOF2>
//===========================DEFINES==========================//
#define CONTASS "Contas/%s.ini"
//===========================ENUMS==========================//
enum pSupremo
{
Supremo,
Clan
};
new pSuper[MAX_PLAYERS][pSupremo];
//===========================NADA======================================//
main()
{
}
//===========================PUBLICS====================================//
public OnGameModeInit()
{
printf(" eu me abri o init adm");
return 1;
}
public OnGameModeExit()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
SalvarPlayer(i);
}
DOF2_Exit();
return 1;
}
public OnPlayerConnect(playerid)
{
new ip[16],name[20],string[150];
GetPlayerIp(playerid, ip, sizeof(ip));
GetPlayerName(playerid,name,sizeof(name));
format(string, 150, "[LOGIN] Player %s has Connected with ip: %s.", name, ip);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(pSuper[playerid][Supremo] >= 1)
{
SendClientMessage(i, -1, string);
}
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SalvarPlayer(playerid);
//==========================================================
new file[155], aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, sizeof(aname));
format(file, sizeof(file), "Contas/%s.ini", aname);
DOF2_SetInt(file, "vSupremo", pSuper[playerid][Clan]);
DOF2_SetInt(file, "vClan", pSuper[playerid][Clan]);
printf(" eu me salvei tudo");
return 1;
}
public OnPlayerSpawn(playerid)
{
CarregarPlayer(playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
//===========================CMDS=====================================//
CMD:setsupremo(playerid, params[])
{
new Level, idplayer, aname[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME], file[155];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "[ ERRO ] {FF0000}Vocк nгo tem acesso a este comando!");
if(sscanf(params, "dd", idplayer, Level)) return SendClientMessage(playerid, -1, "[ ERRO] {FF0000}use: /setsupremo [playerid] [level 0-1]");
if(Level < 0 || Level > 1) return SendClientMessage(playerid, -1, "[ ERRO] {FF0000}Level invalido tente novamente (0-1)");
GetPlayerName(playerid, aname, sizeof(aname));
GetPlayerName(idplayer, pname, sizeof(pname));
format(file, sizeof(file), CONTASS, pname);
DOF2_SetInt(file, "Supremo", Level);
pSuper[idplayer][Supremo] = Level;
SalvarPlayer(idplayer);
printf(" eu me setei adm");
return 1;
}
CMD:myskin(playerid, params[])
{
new id;
if(pSuper[playerid][Supremo] >= 1) return SendClientMessage(playerid,-1, "{FFFFFF} Vocк nгo tem permissгo!");
if(sscanf(params, "d", id)) return SendClientMessage(playerid, -1 , "/myskin id");
SetPlayerSkin(playerid,id);
SendClientMessage(id, -1, " skin id %d");
return 1;
}
CMD:ss(playerid, params[])
{
SalvarPlayer(playerid);
CarregarPlayer(playerid);
printf(" eu salvei tudo");
return 1;
}
//===========================STOCKS===================================//
stock PegarNome(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
return Name;
}
stock SalvarPlayer(playerid)
{
new pArquivos[50];
format(pArquivos, sizeof(pArquivos), CONTASS, PegarNome(playerid));
if(DOF2_FileExists(pArquivos))
{
DOF2_SetInt(pArquivos, "vClan", pSuper[playerid][Clan]);
DOF2_SetInt(pArquivos, "vSupremo", pSuper[playerid][Supremo]);
DOF2_SaveFile();
}
return 1;
}
stock CarregarPlayer(playerid)
{
new pArquivos[50];
format(pArquivos, sizeof(pArquivos), CONTASS, PegarNome(playerid));
if(DOF2_FileExists(pArquivos))
{
pSuper[playerid][Clan] = DOF2_GetInt(pArquivos, "vClan");
pSuper[playerid][Supremo] = DOF2_GetInt(pArquivos, "vSupremo");
}
return 1;
}