Remover Cash -
BaianoIn - 26.09.2013
Iae, to com um problema que nгo estou consequindo resolver...
Adaptei um FS do Kasura de cash
pastebin.com/j23XZH9D
ele tem os comandos, /addcash, /setcash e tals, mas nгo to consequiando retirar esse cash como se fosse dinheiro, a unica alternativa retirar cash e sendo pelo admin, estudei o fs tentei mil vezes mas ta osso. kkk"
Irei dar um exemlo de comando
pawn Код:
if(strcmp(cmd, "/comprarcolete", true) == 0)
{
GivePlayerMoney(playerid, -40);//Funзгo para retirar o cash
SetPlayerArmour(playerid, 100);
return 1;
}
Include SCash usada na FS
pawn Код:
#include <a_samp>
#include <Dini>
new CashPoints[MAX_PLAYERS];
stock CriarCashInfo()
{
if(!fexist("CashSistem.log")) dini_Create("CashSistem.log");
return 1;
}
stock LoadCashInfo(playerid)
{
if(dini_Isset("CashSistem.log",PlayerName(playerid))) CashPoints[playerid] = dini_Int("CashSistem.log",PlayerName(playerid));
return 1;
}
stock SalvarCash(playerid)
{
dini_IntSet("CashSistem.log",PlayerName(playerid),CashPoints[playerid]);
return 0;
}
stock ResetarCash(playerid)
{
CashPoints[playerid] = 0;
return 1;
}
stock SetarCash(playerid,Cash)
{
CashPoints[playerid]=Cash;
return 1;
}
stock AddCash(playerid,Cash)
{
CashPoints[playerid]+=Cash;
return 1;
}
stock TirarCash(playerid,Cash)
{
CashPoints[playerid]-=Cash;
return 1;
}
stock CashInfo(playerid)
{
new Cash;
Cash = CashPoints[playerid];
return Cash;
}
Re: Remover Cash -
zSuYaNw - 26.09.2013
pawn Код:
TirarCash(playerid, casha_ammout);
Re: Remover Cash -
HatedS - 26.09.2013
What, vocк quer retira o cash sem precisar se Admin ?
Re: Remover Cash -
BaianoIn - 26.09.2013
Quote:
Originally Posted by zSuYaNw
pawn Код:
TirarCash(playerid, casha_ammout);
|
@Simples, vlw, eu que estava complicando =D
Re: Remover Cash -
zSuYaNw - 26.09.2013
Vб na include e substitua por isto:
pawn Код:
/*
@
@ Cash include, criada por Kasura.
@
*/
#include <a_samp>
#include <Dini>
new CashPoints[MAX_PLAYERS];
stock CriarCashInfo()
{
if(!fexist("CashSistem.log")) dini_Create("CashSistem.log");
return 1;
}
stock LoadCashInfo(playerid)
{
if(dini_Isset("CashSistem.log",PlayerName(playerid))) CashPoints[playerid] = dini_Int("CashSistem.log",PlayerName(playerid));
return 1;
}
stock SalvarCash(playerid)
{
dini_IntSet("CashSistem.log",PlayerName(playerid),CashPoints[playerid]);
return 0;
}
#define ResetarCash(%0) CashPoints[%0] = 0
#define SetarCash(%0,%1) CashPoints[%0] = %1
#define AddCash(%0,%1) CashPoints[%0] += %1
#define TirarCash(%0,%1) CashPoints[%0] -= %1
#define CashInfo(%0) CashPoints[%0]
Funзхes:
pawn Код:
SetarCash(playerid, 1500); // Seta o cash do player para 1500
printf("Cash do player %d - %d", playerid, CashInfo(playerid)); // Exibe o cash atual.
ResetarCash(playerid); // Reseta o Cash do player
printf("Cash do player %d - %d", playerid, CashInfo(playerid));
SetarCash(playerid, 1500); // Seta novamnete para 1500
AddCash(playerid, 100); // Adiciona +100
printf("Cash do player %d - %d", playerid, CashInfo(playerid));
TirarCash(playerid, 100); // Retira 100
printf("Cash do player %d - %d", playerid, CashInfo(playerid));
Re: Remover Cash -
BaianoIn - 26.09.2013
Blzs, feito =D