SA-MP Forums Archive
Is there a way to do that ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is there a way to do that ? (/showthread.php?tid=461517)



Is there a way to do that ? - bustern - 02.09.2013

Can i do that:When player is in range if point when die to lose money and when kill to get money or something like that:
PHP код:
{
if(
dmarena[playerid] == 1)
GivePlayerMoney(killerid1000);
GameTextForPlayer(playerid"Wasted."50002);
GivePlayerMoney(playerid, -500);




Re: Is there a way to do that ? - Konstantinos - 02.09.2013

Is it about DM? You could check if he's in DM instead of range.
pawn Код:
public OnPlayerDeath( playerid, killerid, reason )
{
    if( IsPlayerInRangeOfPoint( playerid, range, X, Y, Z ) ) // Edit the range, X, Y and Z.
    {
        // If he's in range, get $500 from the player who died
        GivePlayerMoney( playerid, -500 );
    }
    if( killerid != INVALID_PLAYER_ID )
    {
        GivePlayerMoney( killerid, 1000 );
        GameTextForPlayer( playerid, "Wasted.", 5000, 2 );
    }
    return 1;
}



Re: Is there a way to do that ? - bustern - 02.09.2013

Its about DM ARENA, when player is in DM arena, i want when die to lose money and when kill to get money, i am gonna test your script, but is it another way to to that ?


Re: Is there a way to do that ? - Konstantinos - 02.09.2013

You told us about range of point. I believe it's better to check if he's inside DM and then take the money from the playerid. It's better way.

That would be better:
pawn Код:
public OnPlayerDeath( playerid, killerid, reason )
{
    if( dmarena[ playerid ] == 1 ) GivePlayerMoney( playerid, -500 );
    if( killerid != INVALID_PLAYER_ID && dmarena[ killerid ] == 1 )
    {
        GivePlayerMoney( killerid, 1000 );
        GameTextForPlayer( playerid, "Wasted.", 5000, 2 );
    }
    return 1;
}
Don't forget to reset the variable when a player leaves the DM and on player connect too.


Re: Is there a way to do that ? - bustern - 02.09.2013

Thanks !Dont worry, i did it