SA-MP Forums Archive
їComo hago?.. - 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: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: їComo hago?.. (/showthread.php?tid=574597)



їComo hago?.. - ronaldfa - 18.05.2015

Tengo este FS DE Headshot, yo lo que quiero es que cuando MATEN A ALGUIEN CON HEADSHOT SE ESCUCHE UN MP3 CON EL EFECTO DE HEADSHOT (EL LINK LO TENGO YO).

OSEA QUE SE ESCUCHE TANTO COMO AL QUE MATARON Y QUE SE ESCUCHE AL QUE HIZO EL HEADSHOT.. їComo lo adapto?.

Aqui el codigo del headshot que consegui:


PHP код:
#include <a_samp>
 
/*-------------------------
HeadShot System by Peppe
The faster implementation of a headshot system in SA:MP.
This script requires the new version of SA:MP 0.3b.
 
www.pawnoitalia.forumfree.it
www.atlantisgaming.it
-------------------------*/
 
#define TIMER_INTERVAL 150
 
new
    
maxPlayers;
 
public 
OnFilterScriptInit()
{
    
maxPlayers GetMaxPlayers();
    
SetTimer("CheckHeadShot"TIMER_INTERVAL1);
    return 
1;
}
 
public 
OnPlayerDeath(playeridkilleridreason)
{
    if(
GetPVarInt(playerid"Headshotted") == 1)
    {
        
SetPVarInt(playerid"Headshotted"0);
        
GameTextForPlayer(playerid"~r~Headshotted"30003);
        
GameTextForPlayer(killerid"~r~Headshott"30003);
    }
    return 
1;
}
 
forward CheckHeadShot();
public 
CheckHeadShot()
{
    new
        
index;
    for(new 
playeridplayerid maxPlayersplayerid++)
    {
        if(
IsPlayerConnected(playerid))
        {
            
index GetPlayerAnimationIndex(playerid);
            if(
index == 1173 || index == 1175 || index == 1177 || index == 1178)
            {
                
SetPVarInt(playerid"Headshotted"1);
                
SetPlayerHealth(playerid0);
            }
        }
    }
    return 
1;




Respuesta: їComo hago?.. - iimma - 18.05.2015

Esto te va a ayudar: https://sampwiki.blast.hk/wiki/PlayAudioStreamForPlayer


Respuesta: їComo hago?.. - xSeveNx - 18.05.2015

Imagino que esto se harнa detectando el daсo que recibe el jugador y cuando esto sucede se ejecute la acciуn de sonido

https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage_Es

O bien
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
IDs del cuerpo

PHP код:
 #define WEAPON_BODY_PART_CHEST 3
#define WEAPON_BODY_PART_CROTCH 4
#define WEAPON_BODY_PART_LEFT_ARM 5
#define WEAPON_BODY_PART_RIGHT_ARM 6
#define WEAPON_BODY_PART_LEFT_LEG 7
#define WEAPON_BODY_PART_RIGHT_LEG 8
#define WEAPON_BODY_PART_HEAD 9 
El ultimo parбmetro es de las id del cuerpo

Intente buscarte algun ejemplo pero no encontre.

PHP код:
 public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID && weaponid == ID && bodypart == 9)
    {
        
PlayerPlaySound(playerid11300.00.010.0);
    }
    return 
1;

Creo que eso deberнa funcionar, aun que no se si haya o cual es el modo para hacerlo con todas las armas


Respuesta: їComo hago?.. - Revelation - 18.05.2015

Lo que quieres es algo asн como lo que tienes en OnPlayerDeath en el GameTextForPlayer, que cuando matas a alguien te aparece "Headshot" en la pantalla de color rojo el mensaje, їno?

PHP код:
public OnPlayerDeath(playeridkilleridreason

    if(
GetPVarInt(playerid"Headshotted") == 1
    { 
        
SetPVarInt(playerid"Headshotted"0); 
        
GameTextForPlayer(playerid"~r~Headshotted"30003); 
        
GameTextForPlayer(killerid"~r~Headshott"30003);
        
PlayAudioStreamForPlayer(playerid"Tu link MP3 de HeadShot"); //playerid: Este es quien muere 
        
PlayAudioStreamForPlayer(killerid"Tu link MP3 de HeadShot"); //killerid: Este es quien mata al que va a morir(playerid)
    

    return 
1




Re: Respuesta: їComo hago?.. - SickAttack - 19.05.2015

Quote:
Originally Posted by Revelation
Посмотреть сообщение
Lo que quieres es algo asн como lo que tienes en OnPlayerDeath en el GameTextForPlayer, que cuando matas a alguien te aparece "Headshot" en la pantalla de color rojo el mensaje, їno?

PHP код:
public OnPlayerDeath(playeridkilleridreason

    if(
GetPVarInt(playerid"Headshotted") == 1
    { 
        
SetPVarInt(playerid"Headshotted"0); 
        
GameTextForPlayer(playerid"~r~Headshotted"30003); 
        
GameTextForPlayer(killerid"~r~Headshott"30003);
        
PlayAudioStreamForPlayer(playerid"Tu link MP3 de HeadShot"); //playerid: Este es quien muere 
        
PlayAudioStreamForPlayer(killerid"Tu link MP3 de HeadShot"); //killerid: Este es quien mata al que va a morir(playerid)
    

    return 
1

Es mas eficiente y efectivo lo que publico xSeveNx.