SA-MP Forums Archive
Suicide - 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: Suicide (/showthread.php?tid=596112)



Suicide - GeneralAref - 12.12.2015

how to make Suicide script?if player type /det = kill all player around him?


Re: Suicide - Sew_Sumi - 12.12.2015

SetPlayerHealth would help you in this quest... A for loop to go through all players, and check how far they are from the point of the person who did the command.

https://sampforum.blast.hk/showthread.php?tid=4

https://sampforum.blast.hk/showthread.php?tid=30938

https://sampforum.blast.hk/showthread.php?tid=447813


Re: Suicide - GeneralAref - 12.12.2015

i found this
Код:
CMD:detme(playerid, params[])
{
	new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    CreateExplosion(x, y, z, 3, 10.0);
    return 1;
}
But too late it for kill player.


Re: Suicide - Ritzy2K - 12.12.2015

Sorry for any mistake, I'm typing through my phone.
First of all, I think you want player to suicide bomb? Or something like that.
Well. Look for players in the range around him. And set their health to 0, you can make an explosion to make it look better.
Or, if u just want the player to die who uses /kill, just set his health to 0.. I'd write it for you but I'm from phone :3
Cheers.


Re: Suicide - saffierr - 12.12.2015

If you want the player to die with an explosion:
PHP код:
CMD:kill(playeridparams[])
{
   new 
Float:XFloat:YFloat:Z;
   
SetPlayerHealth(playerid0);
   
CreateExplosionForPlayer(playeridXYZ210.0); // Reason of using CreateExplosionForPlayer instead of CreateExplosion is simply because the damage will be only for the player instead of everyone around him.
   
SendClientMessage(playeridCOLOR_BLUE"You have killed yourself!");
   return 
1;




Re: Suicide - GeneralAref - 13.12.2015

Does this works on players around it?


Re: Suicide - Denying - 13.12.2015

PHP код:
CMD:det(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid))
        return 
SendClientMessage(playerid, -1"Error: You are not authorized to use this command.");

    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);

    for(new 
0MAX_PLAYERSI++)
    {
        if(!
IsPlayerConnected(I))
            continue;

        if(
== playerid)
            continue;

        if(
IsPlayerInRangeOfPoint(I15.0xyz))
            
SetPlayerHealth(I0);
    }

    return 
1;

Something like this. I did not test it, just wrote it in the message box. Don't know if it works.


Re: Suicide - Sew_Sumi - 13.12.2015

^^ This fella's got it.

Another thing though is that everybody is assuming he is able to, and is using, fast commands.