SA-MP Forums Archive
[Ajuda] World - 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] World (/showthread.php?tid=536720)



World - zqkRazer - 11.09.2014

Tenho um sistema de headshot do n3xtermapper sla o nome aaheauhe й queria que so funcionasse no world 0 atй o 2

code:

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{

    if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9) //weaponid == 34 <- sniper , bodypart == 9 <- cabeзa
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        CreateExplosion(x, y, z, 12, 10.0);
        SetPlayerHealth(playerid, 0.0);
        GameTextForAll("~n~~n~~n~~n~~n~~n~~B~~H~HEAD ~W~~H~SHOT ~R~~H~BABY !", 5000, 3);
        SendClientMessage(playerid,-1, "{F55454}[INFO]: Vocк acaba de levar 1 Headshot .");
        ContarHeadShot[issuerid] ++;
    }

    new Float:HP;
    GetPlayerHealth(playerid, HP);
    if(weaponid == 34)  SetPlayerHealth(playerid, HP-49);       //SniperRifle



Re: World - FallweN - 11.09.2014

Acho que desse modo funcionarб:

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(0 <= GetPlayerVirtualWorld(playerid) <= 2)
    {
        if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9) //weaponid == 34 <- sniper , bodypart == 9 <- cabeзa
        {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            CreateExplosion(x, y, z, 12, 10.0);
            SetPlayerHealth(playerid, 0.0);
            GameTextForAll("~n~~n~~n~~n~~n~~n~~B~~H~HEAD ~W~~H~SHOT ~R~~H~BABY !", 5000, 3);
            SendClientMessage(playerid,-1, "{F55454}[INFO]: Vocк acaba de levar 1 Headshot .");
            ContarHeadShot[issuerid] ++;
        }

        new Float:HP;
        GetPlayerHealth(playerid, HP);
        if(weaponid == 34)  SetPlayerHealth(playerid, HP-49);       //SniperRifle
    }
    return true;
}



Re: World - ViniBorn - 11.09.2014

pawn Код:
if(GetPlayerVirtualWorld(playerid) > 2) return true;



Re: World - FallweN - 11.09.2014

Quote:
Originally Posted by ViniBorn
Посмотреть сообщение
pawn Код:
if(GetPlayerVirtualWorld(playerid) > 2) return true;
O certo acho que seria:
pawn Код:
if(GetPlayerVirtualWorld(playerid) <= 2) return true;
porque ele quer que funcione no mundo 0 ate o 2.


Re: World - PT - 11.09.2014

Quote:
Originally Posted by FallweN
Посмотреть сообщение
O certo acho que seria:
pawn Код:
if(GetPlayerVirtualWorld(playerid) <= 2) return true;
porque ele quer que funcione no mundo 0 ate o 2.
errado assim vc encerra a continuacao do script

como o vini colocou se o VW for maior que 2, a execucao para, ja no seu ela continua em mundos diferentes de 0, 1, 2


Re: World - zqkRazer - 11.09.2014

nгo deu certo


Re: World - Bruno13 - 11.09.2014

Quote:
Originally Posted by zqkRazer
Посмотреть сообщение
nгo deu certo
Vocк fez como disseram acima pelo menos?
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(GetPlayerVirtualWorld(playerid) > 2) return 1;//caso nгo estiver no VW 0, 1 ou 2, nгo vai executar o code abaixo...
    if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9) //weaponid == 34 <- sniper , bodypart == 9 <- cabeзa
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        CreateExplosion(x, y, z, 12, 10.0);
        SetPlayerHealth(playerid, 0.0);
        GameTextForAll("~n~~n~~n~~n~~n~~n~~B~~H~HEAD ~W~~H~SHOT ~R~~H~BABY !", 5000, 3);
        SendClientMessage(playerid,-1, "{F55454}[INFO]: Vocк acaba de levar 1 Headshot .");
        ContarHeadShot[issuerid] ++;
    }

    new Float:HP;
    GetPlayerHealth(playerid, HP);
    if(weaponid == 34)  SetPlayerHealth(playerid, HP-49);       //SniperRifle

    return true;
}



Re: World - zqkRazer - 11.09.2014

AAAAAAAAAAE Funcionou sу tirei o return true; VLWWW <33


Re: World - zqkRazer - 11.09.2014

Tem como me ajudar com uma coisa tambйm? fiz um textdraw de status pra aparecer o Shots aн a pessoa entra com outra conta e aparece o headshot da conta que estava


Re: World - ViniBorn - 11.09.2014

Quote:
Originally Posted by FallweN
Посмотреть сообщение
O certo acho que seria:
pawn Код:
if(GetPlayerVirtualWorld(playerid) <= 2) return true;
porque ele quer que funcione no mundo 0 ate o 2.
Sua afirmaзгo sу seria vбlida de no lugar do return, fosse { com o restante do cуdigo