Portal SAMP
[Ajuda] Estrela sumir igual ao gta single player - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] Estrela sumir igual ao gta single player (/showthread.php?tid=2818)

Páginas: 1 2 3


RE: Estrela sumir igual ao gta single player - xbruno1000x - 18/09/2022

Coloca um printf no topo dessa public timer para confirmar que ele está sendo chamada para o player.


RE: Estrela sumir igual ao gta single player - fear - 18/09/2022

(18/09/2022 19:56)xbruno1000x Escreveu: Coloca um printf no topo dessa public timer para confirmar que ele está sendo chamada para o player.

Ta chamando a public não sei oque esta havendo..

Código PHP:
forward Contando(playerid);
public 
Contando(playerid)  // Quando completar os 10 segundos, funciona a callback.
{
     new 
number 42;
     
printf("The number is %d.",number);  //-> The number is 42.
     
if(PlayerInfo[playerid][pEstrelas] >= 1
     {
          
PlayerInfo[playerid][pEstrelas] -= 1// Retira uma estrela
          
SetPlayerWantedLevel(playeridPlayerInfo[playerid][pEstrelas]); 
     }
     return 
1;


LOG:
Código PHP:
[20:05:02The number is 42. 



RE: Estrela sumir igual ao gta single player - fear - 18/09/2022

O problema não esta aqui?

assaltei outro caixa pra testar me deu 2 estrelas conto os 10 segundos do timer e me deu + 4 estrela ao invez de remover as estrelas que recebi....

Código PHP:
if(PlayerInfo[playerid][pEstrelas] >= 1
     {
          
PlayerInfo[playerid][pEstrelas] -= 1// Retira uma estrela
          
SetPlayerWantedLevel(playeridPlayerInfo[playerid][pEstrelas]); 
     } 



RE: Estrela sumir igual ao gta single player - xbruno1000x - 19/09/2022

Código PHP:
zesqqq(playerid)
{
    new randomstars random(6/* Retorna um número semi-aleatório entre 0 e 5 se quiser retornar um número mínimo use o RandomEx do Y_LESS que o RosaScripter mandou acima*/str[128];
    SendClientMessage(playeridVermelho"| ZP - BANDIDO | A Camera do Caixa Eletronico estava ligado e a Policia foi alertada!");
    format(strsizeof(str), "[ x ] Voce recebeu +%d Estrelas de Procurado(a)!"randomstars);
    SendClientMessage(playeridAmarelostr);
    PlayerInfo[playerid][pEstrelas] +=randomstars;
    SetPlayerWantedLevel(playeridrandomstars);
    SetTimerEx("Contando"10000false"dd"playeridPlayerInfo[playerid][pEstrelas]); 
}
  

TIMER

Código PHP:
forward Contando(playeridoldWantedLevel);
public 
Contando(playeridoldWantedLevel)  // Quando completar os 10 segundos, funciona a callback.
{

     if(oldWantedLevel 0
     {

          SetPlayerWantedLevel(playeridoldWantedLevel 1); 
     }
     return 
1;



Fiz algumas modificações, teste assim.


RE: Estrela sumir igual ao gta single player - fear - 19/09/2022

(19/09/2022 02:42)xbruno1000x Escreveu:
Código PHP:
zesqqq(playerid)
{
    new randomstars random(6/* Retorna um número semi-aleatório entre 0 e 5 se quiser retornar um número mínimo use o RandomEx do Y_LESS que o RosaScripter mandou acima*/str[128];
    SendClientMessage(playeridVermelho"| ZP - BANDIDO | A Camera do Caixa Eletronico estava ligado e a Policia foi alertada!");
    format(strsizeof(str), "[ x ] Voce recebeu +%d Estrelas de Procurado(a)!"randomstars);
    SendClientMessage(playeridAmarelostr);
    PlayerInfo[playerid][pEstrelas] +=randomstars;
    SetPlayerWantedLevel(playeridrandomstars);
    SetTimerEx("Contando"10000false"dd"playeridPlayerInfo[playerid][pEstrelas]); 
}
  

TIMER

Código PHP:
forward Contando(playeridoldWantedLevel);
public 
Contando(playeridoldWantedLevel)  // Quando completar os 10 segundos, funciona a callback.
{

     if(oldWantedLevel 0
     {

          SetPlayerWantedLevel(playeridoldWantedLevel 1); 
     }
     return 
1;



Fiz algumas modificações, teste assim.
Não adiantou. ganhei 5 estrelas e ao invez de remove-las eu ganhei mais uma kkkkk


RE: Estrela sumir igual ao gta single player - xbruno1000x - 19/09/2022

Tenta por o timer dessa forma então:
Código:
SetTimerEx("Contando", 10000, false, "dd", playerid, randomstars);



RE: Estrela sumir igual ao gta single player - Device-Black - 20/09/2022

Código PHP:
new wantedtime[MAX_PLAYERS];

ChangePlayerWantedLevel(playeridlevel)
{
    if(
SetPlayerWantedLevel(playeridlevel))
    {
        
wantedtime[playerid] = 120 gettime();
    }
    else return 
0;
    return 
1;
}

public 
OnPlayerUpdate(playerid)
{
    if(
GetPlayerWantedLevel(playerid))
    {
        if(
wantedtime[playerid] < gettime())
        {
            static 
stars;
            
stars GetPlayerWantedLevel(playerid);
            
ChangePlayerWantedLevel(playerid, --stars);
        }
    }
    return 
1;

Por ser algo pequeno, acho que assim é mais fácil tanto para usar ou aprender como funciona


RE: Estrela sumir igual ao gta single player - fear - 20/09/2022

(19/09/2022 23:02)xbruno1000x Escreveu: Tenta por o timer dessa forma então:
Código:
SetTimerEx("Contando", 10000, false, "dd", playerid, randomstars);

Funcionou.. porém eu quero que suma todas de uma vez. sumiu apenas uma estrela


RE: Estrela sumir igual ao gta single player - Device-Black - 20/09/2022

(20/09/2022 18:35)fear Escreveu:
(19/09/2022 23:02)xbruno1000x Escreveu: Tenta por o timer dessa forma então:
Código:
SetTimerEx("Contando", 10000, false, "dd", playerid, randomstars);

Funcionou.. porém eu quero que suma todas de uma vez. sumiu apenas uma estrela
Oxi('-') pega o código, estuda e então adapta
Vai ficar esperando bolinho no colo é?
Posso estar sendo rude, mas com tanto codigo enviado você nem sequer tenta modificar algumas coisas


RE: Estrela sumir igual ao gta single player - fear - 20/09/2022

(20/09/2022 19:37)Device-Black Escreveu:
(20/09/2022 18:35)fear Escreveu:
(19/09/2022 23:02)xbruno1000x Escreveu: Tenta por o timer dessa forma então:
Código:
SetTimerEx("Contando", 10000, false, "dd", playerid, randomstars);

Funcionou.. porém eu quero que suma todas de uma vez. sumiu apenas uma estrela
Oxi('-') pega o código, estuda e então adapta
Vai ficar esperando bolinho no colo é?
Posso estar sendo rude, mas com tanto codigo enviado você nem sequer tenta modificar algumas coisas

Eu pedi o código pronto? kkkk se liga zé

edit: ja resolvi. obrigado a quem ajudou!