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



static - Gleisson_. - 22.01.2013

Dae glr d boa ?

Bom a static estб retornando a mesagem.

pawn Код:
static armor[MAX_PLAYERS];

CMD:armor(playerid)
{
    if(armor[playerid] == 1)
    {
        if (GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, red, "Erro: Vocк nгo tem dinheiro suficiente"),PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
   
        GivePlayerMoney(playerid, -3000);
        SetPlayerArmour(playerid, 100);
   
        format(gString, sizeof(gString), "%s comprou colete. ( /Armor )", nome(playerid));
        SendClientMessageToAll(comando, gString);
    }
    else
    {
        SendClientMessage(playerid, red, "Erro: Vocк ja comprou colete !");
    }
    return 1;
}

OnPlayerSpawn:

armor[playerid] = 0;
Ele sу retorna a mensagem.



Re: static - VenoN - 22.01.2013

troque por new garoto pois static global fica a mesma coisa e o new n segura o valor como a static troque para new e muda o nome da variavel tb!

pawn Код:
new Armor[MAX_PLAYERS] = 0;

CMD:armor(playerid)
{
    if(Armor[playerid] == 1)
    {
        if (GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, red, "Erro: Vocк nгo tem dinheiro suficiente"),PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);

        GivePlayerMoney(playerid, -3000);
        SetPlayerArmour(playerid, 100);

        format(gString, sizeof(gString), "%s comprou colete. ( /Armor )", nome(playerid));
        SendClientMessageToAll(comando, gString);
    }
    else
    {
        SendClientMessage(playerid, red, "Erro: Vocк ja comprou colete !");
    }
    return 1;
}

OnPlayerSpawn:

Armor[playerid] = 0;



Re: static - Gleisson_. - 22.01.2013

Vou testar !

@EDIT:

Nгo funciono !


Re: static - JonathanFeitosa - 22.01.2013

pawn Код:
armor[playerid] = 0;
o comando sу funfarб se o valor do armour estiver 1 !

pawn Код:
new ColeteJFS[MAX_PLAYERS];

CMD:armor(playerid)
{
    if(ColeteJFS[playerid] == 1)
    {
        if (GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, red, "Erro: Vocк nгo tem dinheiro suficiente"),PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
   
        ColeteJFS[playerid] = 0;
        GivePlayerMoney(playerid, -3000);
        SetPlayerArmour(playerid, 100);
         
        format(gString, sizeof(gString), "%s comprou colete. ( /Armor )", nome(playerid));
        SendClientMessageToAll(comando, gString);
    }
    else
    {
        SendClientMessage(playerid, red, "Erro: Vocк ja comprou colete !");
    }
    return 1;
}

// OnPlayerSpawn:

ColeteJFS[playerid] = 1;
by


Re: static - ViniBorn - 22.01.2013

Troca
pawn Код:
if(armor[playerid] == 1)
Por
pawn Код:
if(armor[playerid] == 0)



Re: static - Q.I - 22.01.2013

use new.
pawn Код:
new armor[MAX_PLAYERS];

CMD:armor(playerid){
    if(armor[playerid] == 1){
        if (GetPlayerMoney(playerid) < 3000) return
                SendClientMessage(playerid, red, "Erro: Vocк nгo tem dinheiro suficiente"),PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
        GivePlayerMoney(playerid, -3000);
        SetPlayerArmour(playerid, 100);
        format(gString, sizeof(gString), "%s comprou colete. ( /Armor )", nome(playerid));
        SendClientMessageToAll(comando, gString);
    }
    else return SendClientMessage(playerid, red, "Erro: Vocк ja comprou colete !");
    return 1;
}



Re: static - DiReCt hIt - 22.01.2013

No Inicio do Gamemode ..
pawn Код:
new armor[MAX_PLAYERS];
Na OnPlayerConnect:
pawn Код:
armor[playerid] =0;
Na OnPlayerSpawn:
pawn Код:
armor[playerid] =0;
Na OnPlayerDeath:
pawn Код:
armor[playerid] =0;

Juntamente com os seus comandos:
pawn Код:
CMD:armor(playerid)
    {
    if(armor[playerid]== 1)
        {
        SendClientMessage(playerid, Vermelho,"[ERROR]: Vocк ja comprou colete uma vez .");
        return 1;
        }

    if(armor[playerid]== 0)
        {
        new PlayerName[MAX_PLAYER_NAME],
        sbcf[228];
        GetPlayerName(playerid, sbcf, 30);
        format(sbcf, sizeof(sbcf), "%s comprou colete, /COLETE", sbcf);
        SendClientMessageToAll(0xFF0000FF, sbcf);
        SendClientMessage(playerid, Vermelho,"[INFO]: Colete Adquirido, Valor: R$:5.000");
        GivePlayerMoney(playerid,-5000);
        SetPlayerArmour(playerid,100);
        armor[playerid]++;
        return 1;
        }
        }
Se o seu objetivo, era limitar o uso do colete, atй o player morrer .
o cуdigo ta ae .


Re: static - Gleisson_. - 22.01.2013

Quote:
Originally Posted by Jonathan_Feitosa
Посмотреть сообщение
pawn Код:
armor[playerid] = 0;
o comando sу funfarб se o valor do armour estiver 1 !

pawn Код:
new ColeteJFS[MAX_PLAYERS];

CMD:armor(playerid)
{
    if(ColeteJFS[playerid] == 1)
    {
        if (GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, red, "Erro: Vocк nгo tem dinheiro suficiente"),PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
   
        ColeteJFS[playerid] = 0;
        GivePlayerMoney(playerid, -3000);
        SetPlayerArmour(playerid, 100);
         
        format(gString, sizeof(gString), "%s comprou colete. ( /Armor )", nome(playerid));
        SendClientMessageToAll(comando, gString);
    }
    else
    {
        SendClientMessage(playerid, red, "Erro: Vocк ja comprou colete !");
    }
    return 1;
}

// OnPlayerSpawn:

ColeteJFS[playerid] = 1;
by
Fuunfo vlw.

Mais vou testar o do Q.I tbm, se funfar do +rep pra ele tbm.


Re: static - JonathanFeitosa - 22.01.2013

Quote:
Originally Posted by DiReCt hIt
Посмотреть сообщение
No Inicio do Gamemode ..
pawn Код:
new armor[MAX_PLAYERS];
Na OnPlayerConnect:
pawn Код:
armor[playerid] =0;
Na OnPlayerSpawn:
pawn Код:
armor[playerid] =0;
Na OnPlayerDeath:
pawn Код:
armor[playerid] =0;

Juntamente com os seus comandos:
pawn Код:
CMD:armor(playerid)
    {
    if(armor[playerid]== 1)
        {
        SendClientMessage(playerid, Vermelho,"[ERROR]: Vocк ja comprou colete uma vez .");
        return 1;
        }

    if(armor[playerid]== 0)
        {
        new PlayerName[MAX_PLAYER_NAME],
        sbcf[228];
        GetPlayerName(playerid, sbcf, 30);
        format(sbcf, sizeof(sbcf), "%s comprou colete, /COLETE", sbcf);
        SendClientMessageToAll(0xFF0000FF, sbcf);
        SendClientMessage(playerid, Vermelho,"[INFO]: Colete Adquirido, Valor: R$:5.000");
        GivePlayerMoney(playerid,-5000);
        SetPlayerArmour(playerid,100);
        armor[playerid]++;
        return 1;
        }
        }
Se o seu objetivo, era limitar o uso do colete, atй o player morrer .
o cуdigo ta ae .
se sua intenзгo foi ajuda-lу, vai piorar ainda mais, string desnecessбrias, bastante desorganizado.


Re: static - Q.I - 22.01.2013

Quote:
Originally Posted by DiReCt hIt
Посмотреть сообщение
No Inicio do Gamemode ..
pawn Код:
new armor[MAX_PLAYERS];
Na OnPlayerConnect:
pawn Код:
armor[playerid] =0;
Na OnPlayerSpawn:
pawn Код:
armor[playerid] =0;
Na OnPlayerDeath:
pawn Код:
armor[playerid] =0;

Juntamente com os seus comandos:
pawn Код:
CMD:armor(playerid)
    {
    if(armor[playerid]== 1)
        {
        SendClientMessage(playerid, Vermelho,"[ERROR]: Vocк ja comprou colete uma vez .");
        return 1;
        }

    if(armor[playerid]== 0)
        {
        new PlayerName[MAX_PLAYER_NAME],
        sbcf[228];
        GetPlayerName(playerid, sbcf, 30);
        format(sbcf, sizeof(sbcf), "%s comprou colete, /COLETE", sbcf);
        SendClientMessageToAll(0xFF0000FF, sbcf);
        SendClientMessage(playerid, Vermelho,"[INFO]: Colete Adquirido, Valor: R$:5.000");
        GivePlayerMoney(playerid,-5000);
        SetPlayerArmour(playerid,100);
        armor[playerid]++;
        return 1;
        }
        }
Se o seu objetivo, era limitar o uso do colete, atй o player morrer .
o cуdigo ta ae .
edit .

vocк testou isso ae ?
vocк tirou do seu gamemode e quer ensinar os caras ?