SA-MP Forums Archive
[Ajuda] Comando de depositar - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Comando de depositar (/showthread.php?tid=505199)



Comando de depositar - Wanney - 07.04.2014

Ajuda com esse comando de depositar o dinheiro de todos que estгo logados no servidor.
pawn Код:
if(strcmp(cmd, "/depositart", true) == 0) {
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, sizeof(aname));
format(file, sizeof(file), P_CONTAS, aname);
if(pAdmin[playerid] == 5){
new valor;
new grana;
grana = GetPlayerGrana(playerid);
if(grana > valor-1){
format(string, sizeof(string), "(BANCO) O administrador depositou todo seu dinheiro. ");
SendClientMessage(playerid, Verde, string);
dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+valor);
GivePlayerGrana(playerid, -valor);
return 1;
}
}
}
}
return 1;
}



Re: Comando de depositar - VeNuZ_ - 07.04.2014

Que tem de mal ?

@edit agora percebi...
pawn Код:
if(strcmp(cmd, "/depositart", true) == 0) {
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(i,aname, sizeof(aname)); // aqui nгo e playerid mas sim i !
format(file, sizeof(file), P_CONTAS, aname);
if(pAdmin[playerid] == 5){
new valor;
new grana;
grana = GetPlayerGrana(i);
if(grana > valor-1){
format(string, sizeof(string), "(BANCO) O administrador depositou todo seu dinheiro. ");
SendClientMessage(i, Verde, string);
dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+valor);
GivePlayerGrana(i, -valor);
return 1;
}
}
}
}
return 1;
}



Re: Comando de depositar - Wanney - 07.04.2014

Nгo foi


Re: Comando de depositar - VeNuZ_ - 07.04.2014

Explique-se -.-'


Re: Comando de depositar - PT - 07.04.2014

nao tendi o uso do loop ai..

se nao explique melhor

de qualquer forma veja se й isto:

pawn Код:
if(strcmp(cmd, "/depositart", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, sizeof(aname));
    format(file, sizeof(file), P_CONTAS, aname);
    if(pAdmin[playerid] == 5)
    {
        format(string, sizeof(string), "(BANCO) O administrador depositou todo seu dinheiro. ");
        SendClientMessage(playerid, Verde, string);
        dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+GetPlayerGrana(playerid));
        GivePlayerGrana(playerid, -GetPlayerGrana(playerid));
    }
    return 1;
}



Re: Comando de depositar - VeNuZ_ - 07.04.2014

Ele quer que quando o admin digite os comando salva a grana de todos os players online, pelo que percebi de ele ter usado loop e o tipo de sendclientmessage...

Veja MP sfv obg.


Re: Comando de depositar - Wanney - 07.04.2014

Funcionou vlw

Se der algum problema eu arrumo agr