[Pedido] FS sniper
#1

Alguem tem o FS de 2 tiros de sniper mata o player?
Tipo esse: http://forum.sa-mp.com/archive/index.php/t-133364.html


porem o link acima o download ta dando erro,
Reply
#2

Nгo й sу por pra Sniper arrancar metade da vida do player no tiro?
Reply
#3

http://forum.sa-mp.com/showthread.ph...highlight=OPSP
Reply
#4

Nossa, precisa mesmo de um FS pra isto?

Ignore o post do Jefferson Santos, desde a 0.3d jб й ultrapassado.

Existem N formas de se fazer isto, a mais simples й sу retirar 59 da vida do jogador, ou do colete, ou de ambos criando um algoritmo simples.

PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    new 
Float:pHPFloat:pAP;
    
GetPlayerHealth(playerid,pHP);
    
GetPlayerArmour(playerid,pAP);
    if(
pAP 59)
        
pAP -= 59;
    else
    {
        
pHP -= (59 pAP);
        
pAP 0;
    }
    
SetPlayerHealth(playerid,pHP);
    
SetPlayerArmour(playerid,pAP);
    return 
1;

Nгo esquece de verificar se a arma й uma sniper... E se quiser distвncia vocк pode calcular de N maneiras tambйm... A mais fбcil й pelo tamanho do vetor de tiro.
Reply
#5

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart){

    if(
issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9){
    
            
SetPlayerHealth(playerid0.0);
}
return 
1;

esse acima й headshot , caso queria em outros lugares sу adicionar "bodypart == nє" , para mais sobre:
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
https://sampwiki.blast.hk/wiki/Body_Parts
Reply
#6

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart){
new Float:Pvida, Float:Pcolete;

if(issuerid != INVALID_PLAYER_ID && weaponid == 34){
GetPlayerHealth(playerid, Pvida);
GetPlayerArmour(playerid, Pcolete);
if(Pvida >= 1 && Pcolete == 0){
SetPlayerHealth(playerid, Pvida-50);
}else if(Pvida >= 1 && Pcolete >= 1 && Pcolete <= 79){
SetPlayerArmour(playerid, Pcolete-50);
}else if(Pvida >= 1 && Pcolete >= 1 && Pcolete >= 80){
SetPlayerArmour(playerid, Pcolete-20);
}
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)