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



Death Screen - DavidSF - 30.04.2017

Hello, well, how to show only for admins the death screen, and who join and disconnect from server?
Thanks in advance!


Re: Death Screen - Kane - 30.04.2017

Creating something like:
Код:
public SendToAdmins(colour, string[])
{
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
          if(Player[i][AdminLevel] >= 1)
         { 
              SendClientMessage(i, colour, string);
         }
    }
  return 1;
}
Change if(Player[i][AdminLevel] to whatever yours is of course.

OnPlayerDeath
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	new string[128], weapon[128];
	GetWeaponName(reason, weapon, sizeof(weapon));

        format(string, sizeof(string), "AdmWarn: %s killed %s with a(an) %s.", GetName(killerid), GetName(playerid), weapon);
	SendToAdmins(YELLOW, string);
Same for OnPlayerConnect & OnPlayerDisconnect.

Only examples.


Re: Death Screen - Sew_Sumi - 30.04.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Only examples.
Your OnPlayerDeath checks are non-existent, and GetName(killerid) will likely return a real problem.


Re: Death Screen - Kane - 30.04.2017

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Your OnPlayerDeath checks are non-existent, and GetName(killerid) will likely return a real problem.
They're examples from my script. I'm just showing him how it could be done. It all works well.


Re: Death Screen - DavidSF - 30.04.2017

I mean SendDeathMessage (the death screen message).
got it?


Re: Death Screen - Sew_Sumi - 30.04.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
They're examples from my script. I'm just showing him how it could be done. It all works well.
You think it works well...

Quote:
Originally Posted by DavidSF
Посмотреть сообщение
I mean SendDeathMessage (the death screen message).
got it?
You're in here asking for code, yet thing is that this isn't the place.

Arthur has thrown up an example, yet you won't use that structure to make the code what you'd like.

You'll also need to use SendDeathMessageToPlayer , as otherwise the message will be to all.


Re: Death Screen - DavidSF - 18.05.2017

Okay thank you.
How to make demages logs? /dmg cmd
show 20 demages made by players..


Re: Death Screen - Sew_Sumi - 19.05.2017

You'll have to make an array of some sort, that stores the ID of the player who caused the damage, and how much damage they did.

This will be rather advanced as it will require shifting the oldest damages up in the array, and putting them into the next on each OnPlayerTakeDamage/OnPlayerGiveDamage. Which really, may take a bit of work, and you'll need to optimize it as if you do it wrong, you'll end up lagging out the server if multiple people are fighting.


Re: Death Screen - Logic_ - 19.05.2017

@Arthur Kane, please don't throw up examples of un-optimized practices; I'm talking about the MAX_PLAYERS loop, and use optimized ones such as Player-pool size or foreach loops are available.


Re: Death Screen - DavidSF - 22.05.2017

Thank you.