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

slay and slap a player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fix
Member
Join Date: Jun 2005
Old 06-26-2005 , 07:20   slay and slap a player
Reply With Quote #1

i tried it with
edict_t *pKiller = engine->PEntityOfEntIndex(event->GetInt("attacker"));
engine->ClientCommand(pKiller,"kill");

but it doesnt work!

the console just says


StuffCmd: Some entity tried to stuff 'kill' to console buffer of entity 6 when maxclients was set to 8, ignoring

or is there a better way to slay a player? and how about slap? how does this work?
Fix is offline
Send a message via ICQ to Fix Send a message via MSN to Fix
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 06-26-2005 , 09:22   Re: slay and slap a player
Reply With Quote #2

Quote:
Originally Posted by Fix
i tried it with
edict_t *pKiller = engine->PEntityOfEntIndex(event->GetInt("attacker"));
engine->ClientCommand(pKiller,"kill");

but it doesnt work!

the console just says


StuffCmd: Some entity tried to stuff 'kill' to console buffer of entity 6 when maxclients was set to 8, ignoring

or is there a better way to slay a player? and how about slap? how does this work?
events pass the ID of a player not the Index..
get the index of them..then use engine->Clientcommand
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com
BeetleFart is offline
Fix
Member
Join Date: Jun 2005
Old 06-26-2005 , 10:35  
Reply With Quote #3

how to get the index by id?
Fix is offline
Send a message via ICQ to Fix Send a message via MSN to Fix
DevilFingers
New Member
Join Date: Nov 2005
Old 11-01-2005 , 00:43  
Reply With Quote #4

int getIndexFromUserID(int userid)
{
edict_t *player;
IPlayerInfo *info;
for(int i = 1; i <= maxplayers; i++)
{
player = engine->PEntityOfEntIndex(i);
if(!player || player->IsFree() )
continue;
info = playerinfomanager->GetPlayerInfo(player);

if(info->GetUserID() == userid)
return i;
}

return -1;
}

edict_t *pKiller = engine->PEntityOfEntIndex(GetIndexFromUserID(event->GetInt("attacker")));
engine->ClientCommand(pKiller,"kill");
__________________
Matthew Parlane
DevilFingers 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 23:39.


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