Entendi, nгo pensei por esse lado.
Irei te dar uma base da funзгo, na realidade jб vou te dar um sistema feito que fiz agora.
Coisas simples...
Vк se vocк pelo menos tenta entender o que estб escrito aqui.
PHP код:
#include <a_samp>
#include <dof2>
#include <sscanf2>
#include <zcmd> /* Base of Coins - Developed for Cycle */
new coins[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
new save[37], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(save, sizeof(save), "Coins/%s.ini", name);
if(!fexist(save))
{
DOF2::CreateFile(save);
DOF2::SetInt(save, "Coins", coins[playerid]);
}
else
coins[playerid] = DOF2::GetInt(save, "Coins", coins[playerid]);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new save[37], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(save, sizeof(save), "Coins/%s.ini");
if(!fexist(save))
DOF2::SetInt(save, "Coins", coins[playerid]);
else
DOF2::SetInt(save, "Coins", coins[playerid]);
return 1;
}
public OnFilterScriptExit()
{
DOF2::Exit();
return 1;
}
public OnFilterScriptInit()
{
new str[5];
format(str, sizeof(str), "Coins");
if(!fexist(str))
{
print("---------------------------------------------------------------------");
print(" Vocк nгo criou a pasta 'Coins' dentro da pasta Scriptfiles.");
print("---------------------------------------------------------------------");
SendRconCommand("exit");
}
else
{
print("Filterscript carregado! - Developer Cycle");
}
return 1;
}
/* ---------------- Comandos */
CMD:darcash(playerid, params[])
{
new id, valor;
if(sscanf(params, "ud", id, valor))
return SendClientMessage(playerid, -1, "Utilize - /darcash [id] [valor]");
SendClientMessage(id, -1, "Vocк recebeu coins de um player.");
AddCash(id, valor);
return 1;
}
CMD:mycoins(playerid, params[])
{
new str[25];
format(str, sizeof(str), "Vocк possui %d coins.", coins[playerid]);
SendClientMessage(playerid, -1, str);
return 1;
}
/* ---------------- Comandos */
stock AddCash(playerid, valor)
{
coins[playerid] += valor;
return true;
}