[Pedido] Sistema de moedas/cash
#6

Brother fiz uma base, dб para vocк aprender e aproveitar muita coisa com ela, nгo sei se vocк usa DOF2 como salvamento, porйm os mais usados pela minha visгo se eu estiver errado por favor alguйm me corrija й dof2 e mysql.
Se for DOF2 serб mas fбcil ainda para vocк! Bom estб ai!
Bom estudo.
Lembrando, nunca mas venha no fуrum pedindo comandos, e sim bases no mбximo! donde vocк possa estudar e fazer vocк mesmo.
PHP код:
/* Includes */
#include <a_samp> // Nosso amigo Samp
#include <dof2> // Salvamento
#include <zcmd> // Processador de comandos
/* VARIAVEIS */
new Moedas[MAX_PLAYERS];
main()
{
    print(
"\n----------------------------------");
    print(
" MOEDAS BY CAITON ");
    print(
"----------------------------------\n");
}
public 
OnGameModeInit()
{
    
SetGameModeText("Moedas Base Caiton");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}
public 
OnGameModeExit()
{
    
DOF2_Exit();
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
DOF2_CreateFile(PegarConta(playerid));//Criando arquivo do player que conectar obs: fiz para testes, vc nгo vб usar isso no seu servidor.
    
return 1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
/*Salvei as moedas ao sair*/
    
DOF2_SetInt(PegarConta(playerid), "Moedas"Moedas[playerid]);
    
DOF2_SaveFile();
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
/* SETEI AS MOEDAS AO SPAWNAR, RECOMENDO POR ISSO APУS ACERTAR A SENHA*/
    
if(DOF2_FileExists(PegarConta(playerid)))
    {
        
Moedas[playerid] = DOF2_GetInt(PegarConta(playerid), "Moedas");
    }
    return 
1;
}
/* COMANDOS BASE PARA ESTUDO */
CMD:minhasmoedas(playerid)
{
    new 
Msg[120];
    
format(Msgsizeof(Msg), "Vocк tem %d moedas."Moedas[playerid]);/* Diz a quantidade de moedas que voce tem */
    
SendClientMessage(playerid,-1,Msg);
    return 
1;
}
CMD:perdimoedas(playerid)
{
    
Moedas[playerid]--;
    new 
Msg[120];
    
format(Msgsizeof(Msg), "Vocк perdeu +1 moeda, agora Vocк agora estб com %d moedas."Moedas[playerid]); /* Vocк perde 1 moeda */
    
SendClientMessage(playerid,-1,Msg);
    return 
1;
}
CMD:ganheimoedas(playerid)
{
    
Moedas[playerid]++;
    new 
Msg[120];
    
format(Msgsizeof(Msg), "Vocк ganhou +1 moeda, agora Vocк agora estб com %d moedas."Moedas[playerid]);/* Vocк ganha 1 moeda */
    
SendClientMessage(playerid,-1,Msg);
    return 
1;
}
CMD:ganharduasmoedas(playerid)
{
    
Moedas[playerid]+=2;
    new 
Msg[120];
    
format(Msgsizeof(Msg), "Vocк ganhou +2 moeda, agora Vocк agora estб com %d moedas."Moedas[playerid]); /* Vocк ganha duas moedas */
    
SendClientMessage(playerid,-1,Msg);
    return 
1;
}
stock Nome(playerid)
{
        static 
Name[MAX_PLAYER_NAME]; GetPlayerName(playeridNamesizeof(Name)); return Name;
}
stock PegarConta(playerid)
{
        static 
Arquivo[33]; format(Arquivosizeof(Arquivo), "Players/%s.ini"Nome(playerid)); return Arquivo;

Reply


Messages In This Thread
Sistema de moedas/cash - by WiliamBorges - 19.01.2016, 00:53
Re: Sistema de moedas/cash - by Ever_SH - 19.01.2016, 01:21
Re: Sistema de moedas/cash - by Monotox - 19.01.2016, 09:00
Re: Sistema de moedas/cash - by BykiLler - 19.01.2016, 16:05
Re: Sistema de moedas/cash - by ipsLuan - 19.01.2016, 18:08
Re: Sistema de moedas/cash - by Caiton - 20.01.2016, 01:21
Re: Sistema de moedas/cash - by WiliamBorges - 15.02.2016, 22:47
Re: Sistema de moedas/cash - by F1N4L - 16.02.2016, 17:38
Re: Sistema de moedas/cash - by WiliamBorges - 17.02.2016, 20:15
Re: Sistema de moedas/cash - by LockedLucas - 17.02.2016, 20:40

Forum Jump:


Users browsing this thread: 1 Guest(s)