Death Screen
#1

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

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.
Reply
#3

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

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.
Reply
#5

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

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.
Reply
#7

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

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.
Reply
#9

@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.
Reply
#10

Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)