[Pedido] Sniper mata com 1 tiro sу
#1

Pessoal, eu queria pedir a vocкs o que eu devo colocar na "OnPlayerGiveDamage" para que o tiro da sniper sу arranque 100 de dano de longe e tambйm para que o tiro de perto fique invбlidado (nгo tire dano)? Agradeзo muito a quem puder me ajudar, estou atrбs disso tem 5 dias e nгo consigo nada parecido.
Reply
#2

Try

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloatamountweaponid)
{
    if(
GetPlayerWeapon(playerid) == 34)
    {
        new 
Float:Alma;
        
GetPlayerHealth(playerid,health);
        
SetPlayerHealth(damageid,Alma 100);
    }
    return 
1;

Reply
#3

Utilize o OnPlayerWeaponShot. Nгo recomendo nunca o OnPlayerGiveDamage para isso, se nгo vocк estaria desconsiderando qualquer tipo de lag. Depois, basta verificar a posiзгo do player: se estiver prуximo, talvez uns 300.0 de distвncia, pode setar a vida. Caso contrбrio, return false.
Reply
#4

Quote:
Originally Posted by iTakelot
Посмотреть сообщение
Try

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloatamountweaponid)
{
    if(
GetPlayerWeapon(playerid) == 34)
    {
        new 
Float:Alma;
        
GetPlayerHealth(playerid,health);
        
SetPlayerHealth(damageid,Alma 100);
    }
    return 
1;

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloatamountweaponid)
{
    if(
GetPlayerWeapon(playerid) == 34)
    {
        
SetPlayerHealth(damageid,0);
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by JonathanFeitosa
Посмотреть сообщение
Utilize o OnPlayerWeaponShot. Nгo recomendo nunca o OnPlayerGiveDamage para isso, se nгo vocк estaria desconsiderando qualquer tipo de lag. Depois, basta verificar a posiзгo do player: se estiver prуximo, talvez uns 300.0 de distвncia, pode setar a vida. Caso contrбrio, return false.
O ъnico problema й que eu nгo estou sabendo fazer, nгo tem nenhuma base ai nгo? :/
Reply
#6

PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ) {
    if(
hittype == 1) {
        if(
weaponid == 34) {
            
SetPlayerHealth(hitid0);
        }
    }
    return 
1;

Reply
#7

Quote:
Originally Posted by zPain
Посмотреть сообщение
PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ) {
    if(
hittype == 1) {
        if(
weaponid == 34) {
            
SetPlayerHealth(hitid0);
        }
    }
    return 
1;

C:\Users\Jeferson\Desktop\BGT.pwn(9945) : warning 219: local variable "hitid" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Reply
#8

Estб bugando, vocк tem outra variavel definida como "hitid" no topo do seu gamemode?
Reply
#9

Sim eu tinha e modifiquei, porйm esses comandos ainda nгo chegaram aonde eu quero, eu quero por exemplo, de perto o tiro da sniper nгo arrancar sangue ou arrancar bem pouco, e de longe 1 tiro arrancar colete e 1 tiro arrancar a vida... todos esses estгo matando com apenas um tiro, com colete ou sem...
Reply
#10

PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ
{
    if(
hittype == 1
    {
        if(
weaponid == 34)
        {
            new 
Float:armour,Float:xFloat:yFloat:z;
            
GetPlayerPos(playeridx,y,z);
            
GetPlayerArmour(hitidarmour);
            
//20.0 й a distancia
            
if(IsPlayerInRangeOfPoint(hitid20.0xyz))
            {
                
SetPlayerHealth(hitid0);
            }
            else
            {
                if(
armour >= 1)
                {
                    
SetPlayerArmour(hitid0);
                }
                else
                {
                    
SetPlayerHealth(hitid0);
                }
            }
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)