12.11.2015, 00:20
Quote:
//Essa funзгo aqui \/ jб faz o que estб abaixo desses ===
SalvarPlayer(playerid); //O que tem aqui embaixo em verde, vocк pode tirar: //================================================== ======== 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"); |
PHP Code:
// NEW.PWN BY: $C0pAs
//===========================INCLUDES===================================//
#include <a_samp>
#include <ZCMD>
#include <sscanf>
#include <DOF2>
#define CONTASS "Contas/%s.ini"
//===========================NEWS AND FORWARDS==========================//
enum pSupremo
{
Supremo,
Clan
};
new pSuper[MAX_PLAYERS][pSupremo];
//======================================================================//
main()
{
}
//===========================PUBLICS====================================//
public OnGameModeExit()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
SalvarPlayer(i);
}
DOF2_Exit();
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SalvarPlayer(playerid);
return 1;
}
public OnPlayerSpawn(playerid)
{
CarregarPlayer(playerid);
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;
}
//=================[STOCKS DO SERVIDOR]================
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;
}