SA-MP Forums Archive
[Ajuda] Se levou tiro em menos de 1 minuto, nгo pode executar este comando. - 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] Se levou tiro em menos de 1 minuto, nгo pode executar este comando. (/showthread.php?tid=390174)



Se levou tiro em menos de 1 minuto, nгo pode executar este comando. - duuuwh - 05.11.2012

Se levou tiro em menos de 1 minuto, nгo pode executar este comando.

Alguem pode me ajudar para que quem levou um tiro nos ultimos 60 segundos, nгo possa executar este comando?

PHP код:
CMD:fumar(playerid)
{
    if(
Quantidade[playerid] == 0) return GameTextForPlayer(playerid"Sem Cigarros",4000,3);
    
ApplyAnimation(playerid"SMOKING""M_smklean_loop"4.010000);
    
GameTextForPlayer(playerid"~r~Vocк estб fumando um cigarro!",5000,1);
    
Quantidade[playerid] -= 1;
    new 
Float:Vida;
    
GetPlayerHealth(playeridVida);
    
SetPlayerHealth(playeridVida+5);
    return 
1;

Grato.


Re: Se levou tiro em menos de 1 minuto, nгo pode executar este comando. - [FeK]Knife - 05.11.2012

http://forum.sa-mp.com/showthread.ph...onplayerdamage
Baixe essa include e depois faзa isto :

pawn Код:
// Comeзo do GM
new
    LevouumTiro [ MAX_PLAYERS ] ;

//CMD
CMD:fumar(playerid)
{
    if ( LevouumTiro [ playerid ] == 1 ) return SendClientMessage ( playerid , -1 , "Vocк levou um Tiro !" ) ;
    if(Quantidade[playerid] == 0) return GameTextForPlayer(playerid, "Sem Cigarros",4000,3);
    ApplyAnimation(playerid, "SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0);
    GameTextForPlayer(playerid, "~r~Vocк estб fumando um cigarro!",5000,1);
    Quantidade[playerid] -= 1;
    new Float:Vida;
    GetPlayerHealth(playerid, Vida);
    SetPlayerHealth(playerid, Vida+5);
    return 1;
}  

//Public
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    if(LevouumTiro [ playerid ] == 0 && weaponid >= 1 /* Mude pela arma que deseja */) return LevouumTiro [ playerid ] = 1 , SetTimer("LevouTiro", 60000, 0);
    return true;
}

forward LevouTiro ( playerid ) ;
public LevouTiro ( playerid )
    return LevouumTiro [ playerid ] = 0 ;
Teste aн , mals ae , fiz na velocidade aqui , to vendo tv xD


Re: Se levou tiro em menos de 1 minuto, nгo pode executar este comando. - ForT - 05.11.2012

Quote:
Originally Posted by [FeK]Knife
Посмотреть сообщение
http://forum.sa-mp.com/showthread.ph...onplayerdamage
Baixe essa include e depois faзa isto :

pawn Код:
// Comeзo do GM
new
    LevouumTiro [ MAX_PLAYERS ] ;

//CMD
CMD:fumar(playerid)
{
    if ( LevouumTiro [ playerid ] == 1 ) return SendClientMessage ( playerid , -1 , "Vocк levou um Tiro !" ) ;
    if(Quantidade[playerid] == 0) return GameTextForPlayer(playerid, "Sem Cigarros",4000,3);
    ApplyAnimation(playerid, "SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0);
    GameTextForPlayer(playerid, "~r~Vocк estб fumando um cigarro!",5000,1);
    Quantidade[playerid] -= 1;
    new Float:Vida;
    GetPlayerHealth(playerid, Vida);
    SetPlayerHealth(playerid, Vida+5);
    return 1;
}  

//Public
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    if(LevouumTiro [ playerid ] == 0 && weaponid >= 1 /* Mude pela arma que deseja */) return LevouumTiro [ playerid ] = 1 , SetTimer("LevouTiro", 60000, 0);
    return true;
}

forward LevouTiro ( playerid ) ;
public LevouTiro ( playerid )
    return LevouumTiro [ playerid ] = 0 ;
Teste aн , mals ae , fiz na velocidade aqui , to vendo tv xD
no Lugar de SetTimer nao seria SetTimerEx?
e tbm seria melhor trocar OnPlayerGiveDamage por OnPlayerTakeDamage..


Re: Se levou tiro em menos de 1 minuto, nгo pode executar este comando. - [FeK]Knife - 05.11.2012

Me desculpa , mas nгo lembro muito bem das publicґs do SA:MP. E como foi dito , fiz na pressa. Mas nгo irei usar isso como desculpa. Estou voltando sim para o Pawn , nгo lembro muito bem de algumas funзхes , mas com o tempo irei lembrar e voltarei a desgraзe kkkkkkkkkkkkkkkk , mas , desculpa aн pelo erro xP


Re: Se levou tiro em menos de 1 minuto, nгo pode executar este comando. - zSuYaNw - 05.11.2012

Use publics nativas



pawn Код:
http://wiki.sa-mp.com/wiki/OnPlayerTakeDamage



Respuesta: Se levou tiro em menos de 1 minuto, nгo pode executar este comando. - ipsBruno - 05.11.2012

Esse aqui serve:

pawn Код:
new TirosLevados [ MAX_PLAYERS ] ;


public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    TirosLevados[playerid] = gettime();

    return true;
}


CMD:fumar(playerid)
{
    if(gettime() -TirosLevados[playerid] < 60) return GameTextForPlayer(playerid, "Tomou tiro",4000,3);
    if(Quantidade[playerid] == 0) return GameTextForPlayer(playerid, "Sem Cigarros",4000,3);
    ApplyAnimation(playerid, "SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0);
    GameTextForPlayer(playerid, "~r~Vocк estб fumando um cigarro!",5000,1);
    Quantidade[playerid] -= 1;
    new Float:Vida;
    GetPlayerHealth(playerid, Vida);
    SetPlayerHealth(playerid, Vida+5);
    return 1;
}

O problema й que este cуdigo sу funcionarб por mais 25 anos e alguns meses #piadanerd