Vlw pelas sugestхes pessoal, li todas, quem tiver mais posta aн por favor.
@Toddynho/AmericanStyle
Fiz aqui.
Comandos: /ComprarToddynho, /MeusToddynhos e /BeberToddynho
Code:
#include <a_samp>
#include <zcmd>
#include <DOF2>
#define PRECO_TODDYNHO 2
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("FS Toma Toddynho by Aninhaah");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
DOF2_Exit();
return 1;
}
CMD:comprartoddynho(playerid, params[])
{
if(isnull(params)) return SendClientMessage(playerid, -1, "Use: /ComprarToddynho [Quantidade]");
if(GetPlayerMoney(playerid) < PRECO_TODDYNHO*strval(params)) return SendClientMessage(playerid, -1, "Vocк nгo dinheiro suficiente.");
GivePlayerMoney(playerid, -PRECO_TODDYNHO*strval(params));
new string[90];
format(string, sizeof(string),"Vocк comprou %d toddynho(s). Use: /BeberToddynho.", strval(params));
SendClientMessage(playerid, -1, string);
new file[56], nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
format(file, sizeof(file),"Contas/%s.ini", nome);
if(!DOF2_FileExists(file))
{
DOF2_CreateFile(file);
DOF2_SetInt(file,"QtdToddynho", strval(params));
DOF2_SaveFile();
return 1;
}
DOF2_SetInt(file,"QtdToddynho", DOF2_GetInt(file,"QtdToddynho") + strval(params));
DOF2_SaveFile();
return 1;
}
CMD:meustoddynhos(playerid)
{
new file[56], nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
format(file, sizeof(file),"Contas/%s.ini", nome);
if(!DOF2_FileExists(file) || !DOF2_IsSet(file,"QtdToddynho") || DOF2_GetInt(file,"QtdToddynho") < 1) return SendClientMessage(playerid, -1, "Vocк nгo tem toddynho.");
new string[90];
format(string, sizeof(string),"Vocк tem %d toddynho(s). Use: /BeberToddynho", DOF2_GetInt(file,"QtdToddynho"));
SendClientMessage(playerid, -1, string);
return 1;
}
CMD:bebertoddynho(playerid)
{
new file[56], nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
format(file, sizeof(file),"Contas/%s.ini", nome);
if(!DOF2_FileExists(file) || !DOF2_IsSet(file,"QtdToddynho") || DOF2_GetInt(file,"QtdToddynho") < 1) return SendClientMessage(playerid, -1, "Vocк nгo tem toddynho.");
DOF2_SetInt(file, "QtdToddynho", DOF2_GetInt(file,"QtdToddynho")-1);
DOF2_SaveFile();
SendClientMessage(playerid, -1, "Vocк tomou um toddynho e ficou feliz :D");
return 1;
}