[Ajuda] on off a filterscript
#6

PHP код:
// Name:         HidBar
// Author:      Hiddos
// Date:         21st March 2011
// Version:     1.1
// Don't re-release without permission.
#include <a_samp>
#include <zcmd>
#define HITCOLOR 0xFFFFFFAA
#define MAX_HEALTH_LENGTH 2
new Float:old_hp[MAX_PLAYERS];
new 
Float:old_ap[MAX_PLAYERS];
new 
bool:ativado[MAX_PLAYERS];
CMD:filterscript(playeridparams[])
{
        if(
ativado[playerid] == false){
                
ativado[playerid] = true
        }
        else
        {
                
ativado[playerid] = false
        }
return 
1;
}
public 
OnPlayerUpdate(playerid)
{
        if(
ativado[playerid] == true){
    new 
Float:new_hpFloat:new_ap;
    
GetPlayerArmour(playeridnew_ap);
    
GetPlayerHealth(playeridnew_hp);
    if(
new_hp >= old_hp[playerid] && new_ap >= old_ap[playerid])
    {
        
old_hp[playerid] = new_hp;
        
old_ap[playerid] = new_ap;
        return 
1;
    }
    new 
Text3D:hitbar;
    new 
Float:Pos[3];
    new 
diff floatround( (old_hp[playerid] - new_hp) + (old_ap[playerid] - new_ap) );
    new 
string[MAX_HEALTH_LENGTH 1];
    
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
    
format(stringsizeof string"%i"diff);
    
hitbar Create3DTextLabel(stringHITCOLORPos[0], Pos[1], Pos[2] + 0.630.00);
    
SetTimerEx("UpdateHitBar"660"iifffii"_:hitbardiffPos[0], Pos[1], Pos[2] + 0.816HITCOLOR);
    
old_hp[playerid] = new_hp;
    
old_ap[playerid] = new_ap;
}else{
}
    return 
1;
}
public 
OnFilterScriptInit()
{
    for(new 
iMAX_PLAYERSi++)
    {
        
GetPlayerHealth(iold_hp[i]);
        
GetPlayerArmour(iold_ap[i]);
    }
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
old_hp[playerid] = 100.0;
    
old_ap[playerid] = 0.0;
    return 
1;
}
forward UpdateHitBar(Text3D:hitbarhpFloat:xFloat:yFloat:zupdate_nocolor);
public 
UpdateHitBar(Text3D:hitbarhpFloat:xFloat:yFloat:zupdate_nocolor)
{
    
Delete3DTextLabel(hitbar);
    
update_no--;
    if(!
update_no) return;
    new 
string[MAX_HEALTH_LENGTH 1];
    
+= 0.05;
    
color -= 12;
    
format(stringsizeof string"%i"hp);
    
hitbar Create3DTextLabel(stringcolorxyz30.00);
    
SetTimerEx("UpdateHitBar"660"iifffii"_:hitbarhpxyzupdate_nocolor);

fiz isso na correria, vк se funciona.

Й basicamente assim, se o jogador digitar /filterscript vai ativar as funзхes que acontecem em cada jogador pra ele, se ele digitar de novo vai desativar, e assim vai.
Pro comando funcionar й necessбrio ter o processador de comandos ZCMD.
Reply


Messages In This Thread
on off a filterscript - by helpmesamp - 25.07.2017, 01:34
Re: on off a filterscript - by Relaxed - 25.07.2017, 01:40
Re: on off a filterscript - by helpmesamp - 25.07.2017, 01:42
Re: on off a filterscript - by augustogdo - 25.07.2017, 18:02
Re: on off a filterscript - by helpmesamp - 25.07.2017, 19:36
Re: on off a filterscript - by MatheusOliveira - 26.07.2017, 20:23

Forum Jump:


Users browsing this thread: 1 Guest(s)