SA-MP Forums Archive
OnPlayerDeath killer problem.. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerDeath killer problem.. (/showthread.php?tid=241230)



OnPlayerDeath killer problem.. - nejc001 - 17.03.2011

So i made a script where a player1 writes a command that kills player2..
For example:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/boom", cmdtext, true, 10) == 0)
    {
        CreateExplosion(player2x, player2y, player2z, 7, 10.0);  //this kills player 2
        return 1;
    }
    return 0;
}
How to create a SendDeathMessage() so this kill will be shown in kill list..

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{

        if(IsPlayerInRangeOfPoint(playerid,30,player2x,player2y,player2z))
        {
        SendDeathMessage(killer,playerid, reason);  //how to set that killer is that player who wrote /boom cmd to kill player 2?
        }
    }
    return 1;
}



Re: OnPlayerDeath killer problem.. - Cameltoe - 17.03.2011

I would suggest you to use zcmd and sscanf. (sscanf isn't needed, but i prefer using it)

pawn Код:
command(boom, playerid, params[])
{
     new pID;
     if(sscanf(params, "u", pID)) return SendClientMessage(playerid, COLOR, "usage: /boom [ playerid / name ]");
     // GetPlayerPos(pID, x, y, z) and shiiit here.
     CreateExplosion(player2x, player2y, player2z, 7, 10.0);  //this kills player 2    
     return 1;
}