SA-MP Forums Archive
[Ajuda] Ajuda /bonus - 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] Ajuda /bonus (/showthread.php?tid=604624)



Ajuda /bonus - zGuigui2068 - 07.04.2016

Ola Eu tenho na minha Gm esse cmd mas nao ta funcionando ex prefeito da /setarbonus e seta d boas mas quando da /bonus no local diz que o prefeito nao setou o bonus n sei oq ta de errado

pawn Код:
if(strcmp(cmd,"/setarbonus",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pLider] == 7)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USE: /setarbonus [quantidade]");
                    return 1;
                }
                new extorcao;
                extorcao = strval(tmp);
                if(extorcao < 50 || extorcao > 100) { SendClientMessage(playerid, COLOR_GREY, "O Dinheiro que sera tirado pelos players no bonus nгo pode ser - que R$50 ou + que R$100"); return 1; }
                Tax1 = extorcao;
                format(gstring, sizeof(gstring), "> Bonus a ser pego por player agora sera R$%d, daqui em diante.", Tax1);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, gstring);
                format(gstring, sizeof(gstring), "Notнcias: O Prefeito acaba de mudar o Bonus do Dia para R$%d.", Tax1);
                SendClientMessageToAll(COLOR_LIGHTBLUE, gstring);
                dini_IntSet("CofreOrg/Org7.ini","Bonus",Tax1);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк nгo й o Prefeito!");
                return 1;
            }
        }
        return 1;
    }
    if (strcmp(cmd, "/bonus", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerToPoint(5.0,playerid,358.5072,168.9830,1008.3828))
            {
                if(PegaPresente[playerid] == 0)
                {
                     if(dini_Isset("CofreOrg/Org7.ini","Bonus"))
                     {
                        new Bonus = dini_Int("CofreOrg/Org7.ini","Bonus"); Bonus += 50;
                        //Extas
                        if(IsACop(playerid)){ Bonus += 50; }
                        if(PlayerInfo[playerid][pCargo] > 0){ Bonus += 10; }
                        if(PlayerInfo[playerid][pEmprego] > 0){ Bonus += 20; }
                        if(PlayerInfo[playerid][pCash1] > 0){ Bonus += 100; }
                        //
                        if(dini_Int("CofreOrg/Org7","Total") >= Bonus)
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "> Prefeitura: %s acabou de pegar o seu Bonus do Dia.", sendername);
                            SendClientMessageToAll(COR_PRE,string);
                            format(gstring, sizeof(gstring), "> Prefeitura: vocк recebeu serca de R$%d de Bonus.", Bonus);
                            SendClientMessage(playerid,COR_PRE,gstring);
                            PegaPresente[playerid] = 1;
                            //ChecaTempoExp(playerid);
                            PlayerInfo[playerid][pPayDay] ++;
                            GranaRockstar(playerid, Bonus);
                            Emposto=dini_Int("CofreOrg/Org7.ini","Total");
                            Emposto-=Bonus;
                            dini_IntSet("CofreOrg/Org7.ini","Total",Emposto);
                            return 1;
                         }
                         else{ SendClientMessage(playerid,COLOR_GRAD1," O Cofre da Prefeitura nгo tem dinheiro suficiente!"); }
                     }
                     else{ SendClientMessage(playerid,COLOR_GRAD1," O Prefeito ainda nгo seto o valor que sera o Bonus!"); }
                }
                else{ SendClientMessage(playerid, COLOR_GRAD1, " Vocк ja pego o bonus, espere ate o proximo PayDay para pegar novamente!!"); }
            }
            else{ SendClientMessage(playerid, COLOR_GRAD1, " Vocк nгo estб dentro da Prefeitura!!"); }
        }
        return 1;
    }



Re: Ajuda /bonus - Pxndx - 08.04.2016

tenta alterar o 4є if do comando /bonus:
PHP код:
if(dini_Isset("CofreOrg/Org7.ini","Bonus")) 
para:
PHP код:
if(dini_Get("CofreOrg/Org7.ini","Bonus") > 0



Re: Ajuda /bonus - F1N4L - 08.04.2016

Crie uma var GLOBAL para armazenar os valores do Bonus. Vc vai criar variбveis locais desnecessбriamente. E pelo q eu percebi, como o User acima comentou, vc estб definindo um valor e n o getando!


Re: Ajuda /bonus - zGuigui2068 - 08.04.2016

pawn Код:
C:\Users\Gustavo\Desktop\BSR GM OF - Cуpia\BSR GM OF - Cуpia\Gamemodes\BSR.pwn(41887) : error 033: array must be indexed (variable "dini_Get")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: Ajuda /bonus - BykiLler - 08.04.2016

wooo caraca й string nгo int


Re: Ajuda /bonus - Pxndx - 08.04.2016

desculpe, tente isso:
PHP код:
if(strval(dini_Get("CofreOrg/Org7.ini","Bonus")) > 0



Re: Ajuda /bonus - zGuigui2068 - 08.04.2016

pawn Код:
if(strcmp(cmd,"/setarbonus",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pLider] == 7)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USE: /setarbonus [quantidade]");
                    return 1;
                }
                new extorcao;
                extorcao = strval(tmp);
                if(extorcao < 50 || extorcao > 100) { SendClientMessage(playerid, COLOR_GREY, "O Dinheiro que sera tirado pelos players no bonus nгo pode ser - que R$50 ou + que R$100"); return 1; }
                Tax1 = extorcao;
                format(gstring, sizeof(gstring), "> Bonus a ser pego por player agora sera R$%d, daqui em diante.", Tax1);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, gstring);
                format(gstring, sizeof(gstring), "Notнcias: O Prefeito acaba de mudar o Bonus do Dia para R$%d.", Tax1);
                SendClientMessageToAll(COLOR_LIGHTBLUE, gstring);
                dini_IntSet("CofreOrg/Org7.ini","Bonus",Tax1);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк nгo й o Prefeito!");
                return 1;
            }
        }
        return 1;
    }
    if (strcmp(cmd, "/bonus", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerToPoint(5.0,playerid,358.5072,168.9830,1008.3828))
            {
                if(PegaPresente[playerid] == 0)
                {
                     if(strval(dini_Get("CofreOrg/Org7.ini","Bonus")) > 0)
                     {
                        new Bonus = dini_Int("CofreOrg/Org7.ini","Bonus"); Bonus += 50;
                        //Extas
                        if(IsACop(playerid)){ Bonus += 50; }
                        if(PlayerInfo[playerid][pCargo] > 0){ Bonus += 10; }
                        if(PlayerInfo[playerid][pEmprego] > 0){ Bonus += 20; }
                        if(PlayerInfo[playerid][pCash1] > 0){ Bonus += 100; }
                        //
                        if(dini_Int("CofreOrg/Org7","Total") >= Bonus)
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "> Prefeitura: %s acabou de pegar o seu Bonus do Dia.", sendername);
                            SendClientMessageToAll(COR_PRE,string);
                            format(gstring, sizeof(gstring), "> Prefeitura: vocк recebeu serca de R$%d de Bonus.", Bonus);
                            SendClientMessage(playerid,COR_PRE,gstring);
                            PegaPresente[playerid] = 1;
                            //ChecaTempoExp(playerid);
                            PlayerInfo[playerid][pPayDay] ++;
                            GranaRockstar(playerid, Bonus);
                            Emposto=dini_Int("CofreOrg/Org7.ini","Total");
                            Emposto-=Bonus;
                            dini_IntSet("CofreOrg/Org7.ini","Total",Emposto);
                            return 1;
                         }
                         else{ SendClientMessage(playerid,COLOR_GRAD1," O Cofre da Prefeitura nгo tem dinheiro suficiente!"); }
                     }
                     else{ SendClientMessage(playerid,COLOR_GRAD1," O Prefeito ainda nгo seto o valor que sera o Bonus!"); }
                }
                else{ SendClientMessage(playerid, COLOR_GRAD1, " Vocк ja pego o bonus, espere ate o proximo PayDay para pegar novamente!!"); }
            }
            else{ SendClientMessage(playerid, COLOR_GRAD1, " Vocк nгo estб dentro da Prefeitura!!"); }
        }
        return 1;
    }
Deu em nada


Re: Ajuda /bonus - Pxndx - 09.04.2016

tenta assim
PHP код:
if(strcmp(cmd,"/setarbonus",true)==0)
{
    if(
IsPlayerConnected(playerid))
    {
        if(
PlayerInfo[playerid][pLider] == 7)
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_WHITE"USE: /setarbonus [quantidade]");
                return 
1;
            }
            new 
extorcao;
            
extorcao strval(tmp);
            if(
extorcao 50 || extorcao 100) { SendClientMessage(playeridCOLOR_GREY"O Dinheiro que sera tirado pelos players no bonus nгo pode ser - que R$50 ou + que R$100"); return 1; }
            
Tax1 extorcao;
            
format(gstringsizeof(gstring), "> Bonus a ser pego por player agora sera R$%d, daqui em diante."Tax1);
            
SendClientMessage(playeridCOLOR_LIGHTBLUEgstring);
            
format(gstringsizeof(gstring), "Notнcias: O Prefeito acaba de mudar o Bonus do Dia para R$%d."Tax1);
            
SendClientMessageToAll(COLOR_LIGHTBLUEgstring);
            
dini_IntSet("CofreOrg/Org7.ini","Bonus",Tax1);
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo й o Prefeito!");
            return 
1;
        }
    }
    return 
1;
}
if (
strcmp(cmd"/bonus"true) == 0)
{
    if(
IsPlayerConnected(playerid))
    {
        if(
PlayerToPoint(5.0,playerid,358.5072,168.9830,1008.3828))
        {
            if(
PegaPresente[playerid] == 0)
            {
                 if(
dini_Int("CofreOrg/Org7.ini","Bonus") > 0)
                 {
                    new 
Bonus dini_Int("CofreOrg/Org7.ini","Bonus"); Bonus += 50;
                    
//Extas
                    
if(IsACop(playerid)){ Bonus += 50; }
                    if(
PlayerInfo[playerid][pCargo] > 0){ Bonus += 10; }
                    if(
PlayerInfo[playerid][pEmprego] > 0){ Bonus += 20; }
                    if(
PlayerInfo[playerid][pCash1] > 0){ Bonus += 100; }
                    
//
                    
if(dini_Int("CofreOrg/Org7","Total") >= Bonus)
                    {
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        
format(stringsizeof(string), "> Prefeitura: %s acabou de pegar o seu Bonus do Dia."sendername);
                        
SendClientMessageToAll(COR_PRE,string);
                        
format(gstringsizeof(gstring), "> Prefeitura: vocк recebeu serca de R$%d de Bonus."Bonus);
                        
SendClientMessage(playerid,COR_PRE,gstring);
                        
PegaPresente[playerid] = 1;
                        
//ChecaTempoExp(playerid);
                        
PlayerInfo[playerid][pPayDay] ++;
                        
GranaRockstar(playeridBonus);
                        
Emposto=dini_Int("CofreOrg/Org7.ini","Total");
                        
Emposto-=Bonus;
                        
dini_IntSet("CofreOrg/Org7.ini","Total",Emposto);
                        return 
1;
                     }
                     else{ 
SendClientMessage(playerid,COLOR_GRAD1," O Cofre da Prefeitura nгo tem dinheiro suficiente!"); }
                 }
                 else{ 
SendClientMessage(playerid,COLOR_GRAD1," O Prefeito ainda nгo seto o valor que sera o Bonus!"); }
            }
            else{ 
SendClientMessage(playeridCOLOR_GRAD1" Vocк ja pego o bonus, espere ate o proximo PayDay para pegar novamente!!"); }
        }
        else{ 
SendClientMessage(playeridCOLOR_GRAD1" Vocк nгo estб dentro da Prefeitura!!"); }
    }
    return 
1;




Re: Ajuda /bonus - zGuigui2068 - 09.04.2016

novamente o prefeito nao setou o bonus


Re: Ajuda /bonus - RodrigoMSR - 09.04.2016

PHP код:
if(strcmp(cmd,"/setarbonus",true)==0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pLider] == 7)
            {
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USE: /setarbonus [quantidade]");
                    return 
1;
                }
                new 
extorcao;
                
extorcao strval(tmp);
                if(
extorcao 50 || extorcao 100) { SendClientMessage(playeridCOLOR_GREY"O Dinheiro que sera tirado pelos players no bonus nгo pode ser - que R$50 ou + que R$100"); return 1; }
                
Tax1 extorcao;
                
format(gstringsizeof(gstring), "> Bonus a ser pego por player agora sera R$%d, daqui em diante."Tax1);
                
SendClientMessage(playeridCOLOR_LIGHTBLUEgstring);
                
format(gstringsizeof(gstring), "Notнcias: O Prefeito acaba de mudar o Bonus do Dia para R$%d."Tax1);
                
SendClientMessageToAll(COLOR_LIGHTBLUEgstring);
                if(!
dini_Exists("CofreOrg/Org7.ini")) dini_Create("CofreOrg/Org7.ini");
                
dini_IntSet("CofreOrg/Org7.ini","Bonus",Tax1);
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo й o Prefeito!");
                return 
1;
            }
        }
        return 
1;
    }
    if (
strcmp(cmd"/bonus"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerToPoint(5.0,playerid,358.5072,168.9830,1008.3828))
            {
                if(
PegaPresente[playerid] == 0)
                {
                     if(
dini_Int("CofreOrg/Org7.ini","Bonus") > 0)
                     {
                        new 
Bonus dini_Int("CofreOrg/Org7.ini","Bonus"); Bonus += 50;
                        
//Extas
                        
if(IsACop(playerid)){ Bonus += 50; }
                        if(
PlayerInfo[playerid][pCargo] > 0){ Bonus += 10; }
                        if(
PlayerInfo[playerid][pEmprego] > 0){ Bonus += 20; }
                        if(
PlayerInfo[playerid][pCash1] > 0){ Bonus += 100; }
                        
//
                        
if(dini_Int("CofreOrg/Org7","Total") >= Bonus)
                        {
                            
GetPlayerName(playeridsendernamesizeof(sendername));
                            
format(stringsizeof(string), "> Prefeitura: %s acabou de pegar o seu Bonus do Dia."sendername);
                            
SendClientMessageToAll(COR_PRE,string);
                            
format(gstringsizeof(gstring), "> Prefeitura: vocк recebeu serca de R$%d de Bonus."Bonus);
                            
SendClientMessage(playerid,COR_PRE,gstring);
                            
PegaPresente[playerid] = 1;
                            
//ChecaTempoExp(playerid);
                            
PlayerInfo[playerid][pPayDay] ++;
                            
GranaRockstar(playeridBonus);
                            
Emposto=dini_Int("CofreOrg/Org7.ini","Total");
                            
Emposto-=Bonus;
                            
dini_IntSet("CofreOrg/Org7.ini","Total",Emposto);
                            return 
1;
                         }
                         else{ 
SendClientMessage(playerid,COLOR_GRAD1," O Cofre da Prefeitura nгo tem dinheiro suficiente!"); }
                     }
                     else{ 
SendClientMessage(playerid,COLOR_GRAD1," O Prefeito ainda nгo seto o valor que sera o Bonus!"); }
                }
                else{ 
SendClientMessage(playeridCOLOR_GRAD1" Vocк ja pego o bonus, espere ate o proximo PayDay para pegar novamente!!"); }
            }
            else{ 
SendClientMessage(playeridCOLOR_GRAD1" Vocк nгo estб dentro da Prefeitura!!"); }
        }
        return 
1;
    }