Raised This Month: $ Target: $400
 0% 

Link a death to the killer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Faucheur
New Member
Join Date: May 2010
Old 11-27-2011 , 19:52   Link a death to the killer
Reply With Quote #1

Hello guys,

I'm a beginner in scripting and I block on one little problem.
So, I would like to know if there is a client command (or anything else) to kill a player and link it to the client ?

In details => My plugin create a beam and when a player break the beam, I kill him by the command "ForcePlayerSuicide". but what I would like, it's than the kill in attached to the beam owner and this owner receive +1 in frags.

Do you know if there is a command doing that ?
Any Ideas ?

THanks guys ;)

P.S.: Sorry if I did some mistakes, my english isn't perfect :p
Faucheur is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 11-27-2011 , 20:26   Re: Link a death to the killer
Reply With Quote #2

You would have to somehow assign the entity of the player who "armed" the beam to the beam entity that you created.

Then when another player breaks that beam, kill that player, and award the owner of the beam +1 frag...

There are probably a bunch of different ways to accomplish this - one way I did it with the DropMoneyOnDeath was with a TrieArray... in the array I put the UserID of the player that dropped the money and the amount of the money...

chopped up code, but enough to show you how I did what I did... not saying my way is the correct or only way - it's just the way I did it
Code:
enum MoneyAttributes { AMOUNT, WHO }; DropMoney(client) {     new ent;         if((ent = CreateEntityByName("prop_physics_multiplayer")) != -1)     {         // CREATED ENTITY AND OTHER INFO                 // Get amount of cash to assign this dropped money for the trie         new amount = (clientCash * PercentOfMoney / 100);                         // Get the UserID of the client (player/victim) for the trie         new UserID = GetClientUserId(client);                 // Begin storing entity information in a trie array         new String:sEntity[12]         IntToString(ent, sEntity, sizeof(sEntity));                 new MoneyDroppedInfo[MoneyAttributes];         MoneyDroppedInfo[AMOUNT] = amount;         MoneyDroppedInfo[WHO] = UserID;                 // Set trie for this entity with UserID and amount information         SetTrieArray(h_Trie, sEntity, MoneyDroppedInfo[0], 2, true);                 // Hook the money entity to know when a player touches it         SDKHook(ent, SDKHook_StartTouch, StartTouch);     } }

Last edited by TnTSCS; 11-27-2011 at 20:31.
TnTSCS is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode