SA-MP Forums Archive
[Ajuda] Me ajudem com esse fs - 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] Me ajudem com esse fs (/showthread.php?tid=424752)



Me ajudem com esse fs - Bl4ckN3w - 23.03.2013

Galera esse fs й akeles para servidores a/d quando a pessoa acerta um tiro faz barulho mas so q esse fs ele so faz barulho quando vc leva tiro nao quando vc acerta o tiro no outro player entao quem puder me ajuda ajeita no caso qeria q ele so fizesse barulho quando a pessoa q atirou acertase o tiro.
Quem puder me ajuda ae flw

SkYPE: gustavosilva.samp

#include <a_samp>

#define AT 1.3//Altura do objeto em cima da cabeзa

new ObjetoArma[MAX_PLAYERS];//criar a variбvel pra todos os players
new timerfs[MAX_PLAYERS];

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
//----------------- Sons de sino -------------
PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
if(issuerid != INVALID_PLAYER_ID)
{
//-------------- playerid ----------------//
KillTimer(timerfs[playerid]);
if(ObjetoArma[playerid] > 0)DestroyObject(ObjetoArma[playerid]);//aqui checa se o objeto existe, pra nгo destruir outros objetos..
ObjetoArma[playerid] = CreateObject(weaponid+324, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);//aqui cria o objeto a ser mostrado.
AttachObjectToPlayer(ObjetoArma[playerid], playerid, 0.0, 0.0, AT,0.0,0.0,0.0);//aqui gruda o objeto em cima da cabeзa do jogador
timerfs[playerid] = SetTimerEx("DestroirArma", 1000, 0, "i", playerid);//aqui dispara um timer de 1 segundo, para sumir o objeto
//-------------- issuerid ----------------//
KillTimer(timerfs[issuerid]);
if(ObjetoArma[issuerid] > 0)DestroyObject(ObjetoArma[issuerid]);
ObjetoArma[issuerid] = CreateObject(weaponid+324, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToPlayer(ObjetoArma[issuerid], issuerid, 0.0, 0.0, AT,0.0,0.0,0.0);
timerfs[issuerid] = SetTimerEx("DestroirArma", 1000, 0, "i", issuerid);
}
return true;
}

forward DestroirArma(playerid);
public DestroirArma(playerid)
{
DestroyObject(ObjetoArma[playerid]);
return true;
}


Re: Me ajudem com esse fs - Lуs - 25.03.2013

Tente trocar OnPlayerTakeDamage por OnPlayerGiveDamage.

pawn Код:
#include <a_samp>

#define AT 1.3

new ObjetoArma[MAX_PLAYERS];//criar a variбvel pra todos os players
new timerfs[MAX_PLAYERS];

public OnPlayerGiveDamage(playerid, damagedid, Float:amount)
{
    //----------------- Sons de sino -------------
    PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
    PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
    if(issuerid != INVALID_PLAYER_ID)
    {
        //-------------- playerid ----------------//
        KillTimer(timerfs[playerid]);
        if(ObjetoArma[playerid] > 0)DestroyObject(ObjetoArma[playerid]);//aqui checa se o objeto existe, pra nгo destruir outros objetos..
        ObjetoArma[playerid] = CreateObject(weaponid+324, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);//aqui cria o objeto a ser mostrado.
        AttachObjectToPlayer(ObjetoArma[playerid], playerid, 0.0, 0.0, AT,0.0,0.0,0.0);//aqui gruda o objeto em cima da cabeзa do jogador
        timerfs[playerid] = SetTimerEx("DestroirArma", 1000, 0, "i", playerid);//aqui dispara um timer de 1 segundo, para sumir o objeto
        //-------------- issuerid ----------------//
        KillTimer(timerfs[issuerid]);
        if(ObjetoArma[issuerid] > 0)DestroyObject(ObjetoArma[issuerid]);
        ObjetoArma[issuerid] = CreateObject(weaponid+324, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToPlayer(ObjetoArma[issuerid], issuerid, 0.0, 0.0, AT,0.0,0.0,0.0);
        timerfs[issuerid] = SetTimerEx("DestroirArma", 1000, 0, "i", issuerid);
    }

    return true;
}

forward DestroirArma(playerid);
public DestroirArma(playerid)
{
    DestroyObject(ObjetoArma[playerid]);
    return true;
}



Re: Me ajudem com esse fs - Bl4ckN3w - 25.03.2013

Ae Los continuo a mesma coisa ele faz o som sу quando agente leva tiro eu nгo quero isso. Ex:Tipo eu atirei em vc acertei ae sim eu vou ouvir o barulho do sino eu quero q sу apareзa quando a pessoa q atiro acerta ae essa pessoa q atirou vai ouvir o barulho do sino. Se puder me ajuda flw.


Re: Me ajudem com esse fs - Kuddy - 25.03.2013

Faзa debug. Era pra estar funcionando.


Re: Me ajudem com esse fs - paulor - 25.03.2013

Se puder escrever corretamente й melhor cara, dessa maneira nгo se entende muita coisa nгo..
Vocк quer que somente o atirador ouзa o tiro ?



Re: Me ajudem com esse fs - Kuddy - 25.03.2013

Quote:
Originally Posted by paulor
Посмотреть сообщение
Se puder escrever corretamente й melhor cara, dessa maneira nгo se entende muita coisa nгo..
Vocк quer que somente o atirador ouзa o tiro ?
Pelo que eu entendi, apenas o player que leva dano estб ouvindo o som. O player que da o tiro nгo estб ouvindo. O cуdigo mostra que os 2 deveriam ouvir o som.


Re: Me ajudem com esse fs - Bl4ckN3w - 25.03.2013

Mano continua dando um erro tem como vc me add no skype: gustavosilva.samp



Nao sei oq tem de errado ta mostrando erro na linha 23 na hora de compilar



PHP код:
#include <a_samp>
#define AT 1.3//Altura do objeto em cima da cabeзa
new ObjetoArma[MAX_PLAYERS];//criar a variбvel pra todos os players
new timerfs[MAX_PLAYERS];
public 
OnFilterScriptInit()
{
print(
"OII!!! •••");
return 
1;
}
public 
OnFilterScriptExit()
{
print(
"TCHAUU!!! •••");
return 
1;
}
public 
OnPlayerGiveDamage(playeridissueridFloat:amountweaponid)
{
//----------------- Sons de sino -------------
PlayerPlaySound(playerid178020.00.00.0);
PlayerPlaySound(issuerid178020.00.00.0);
if(
issuerid != INVALID_PLAYER_ID)
{
//-------------- playerid ----------------//
KillTimer(timerfs[playerid]);
if(
ObjetoArma[playerid] > 0)DestroyObject(ObjetoArma[playerid]);//aqui checa se o objeto existe, pra nгo destruir outros objetos..
ObjetoArma[playerid] = CreateObject(weaponid+3240.00.00.00.00.00.0);//aqui cria o objeto a ser mostrado.
AttachObjectToPlayer(ObjetoArma[playerid], playerid0.00.0AT,0.0,0.0,0.0);//aqui gruda o objeto em cima da cabeзa do jogador
timerfs[playerid] = SetTimerEx("DestroirArma"10000"i"playerid);//aqui dispara um timer de 1 segundo, para sumir o objeto
//-------------- issuerid ----------------//
KillTimer(timerfs[issuerid]);
if(
ObjetoArma[issuerid] > 0)DestroyObject(ObjetoArma[issuerid]);
ObjetoArma[issuerid] = CreateObject(weaponid+3240.00.00.00.00.00.0);
AttachObjectToPlayer(ObjetoArma[issuerid], issuerid0.00.0AT,0.0,0.0,0.0);
timerfs[issuerid] = SetTimerEx("DestroirArma"10000"i"issuerid);
}
return 
true;
}
forward DestroirArma(playerid);
public 
DestroirArma(playerid)
{
DestroyObject(ObjetoArma[playerid]);
return 
true;




Re: Me ajudem com esse fs - Kuddy - 25.03.2013

Nгo da pra usar OnPlayerGiveDamage nesse caso. Se vc atirar no lag usando OnPlayerGiveDamage, nгo vai dar nada.

Tente um debug como:
printf("playerid = %d, issuerid = %d", playerid, issuerid);


Re: Me ajudem com esse fs - Bl4ckN3w - 25.03.2013

Acho q agora foi vou colocar no meu servidor pra ver pq meu hamachi nao qer funcionar vlw pela ajuda.


Re: Me ajudem com esse fs - Lуs - 25.03.2013

Quote:
Originally Posted by Bl4ckN3w
Посмотреть сообщение
Kuddy tem como vc monta ele pra min pq eu nao entendo nada nada msm de pawno tou aprendeno tem como fazer se nu tiver tranquilao flw.
Leia meu post acima.