Raised This Month: $51 Target: $400
 12% 

Stock doesn't kill a players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 05-16-2015 , 14:11   Stock doesn't kill a players
Reply With Quote #1

I have my own stock

PHP Code:
stock UserKill(idinflictor 0killer 0weapon 0body 0shouldgib 0damagebits 0bool:addDeath false) {
if(!
userAlive(id) || !userConnected(killer)) return;

new 
iDeaths;
if(!
addDeathiDeaths get_pdata_int(id444);
set_pdata_int(id75body);
set_pdata_int(id76damagebits);
set_pdata_int(id1071);
set_pev(idpev_dmg_inflictorinflictor inflictor killer killer id);
set_msg_block(83BLOCK_ONCE);
ExecuteHamB(Ham_Killedidkiller killer idshouldgib);
if(!
addDeathset_pdata_int(id444iDeaths);

if(
userAlive(id)) return;

new 
effect pev(idpev_effects);
if(
effect 128set_pev(idpev_effectseffect 128);

new 
lenname[32];
if(
get_weaponname(weaponname31)) {
if(~
1<<4|1<<6|1<<9|1<<25 1<<weaponlen 7;
else 
name "grenade";
}
else 
name weapon == "tracktrain" "world";

emessage_begin(MSG_ALL83);
ewrite_byte(killer killer id);
ewrite_byte(id);
ewrite_byte(body == 0);
ewrite_string(name[len]);
emessage_end();

when I use it in the following way (suicide):

PHP Code:
public SomeFunction(id) {
UserKill(id);

doesn't kill a player

Last edited by Arkshine; 05-17-2015 at 09:42.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 05-16-2015 , 14:22   Re: Stock doesn't kill a players
Reply With Quote #2

You're using ExecuteHamB. Could something be blocking your call?
__________________
In Flames we trust!
Nextra is offline
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 05-16-2015 , 14:30   Re: Stock doesn't kill a players
Reply With Quote #3

I think that checking userConnected (killer) blocks a call. Now it noticed
By default killer = 0

so, userConnected(0) is wrong

I changed

userConnected(killer)

to

userConnected(killer ? killer : id)

I'll check if that works
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 05-16-2015 , 16:17   Re: Stock doesn't kill a players
Reply With Quote #4

Solved
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-16-2015 , 22:55   Re: Stock doesn't kill a players
Reply With Quote #5

You know better than to blank out your post . . .
__________________
fysiks 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 17:15.


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