Raised This Month: $ Target: $400
 0% 

FakeClients - specifically their weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 09-03-2007 , 09:10   FakeClients - specifically their weapons
Reply With Quote #1

Hi all,

I'm still playing around with fakeclients for testing purposes.
(I can't run CS, so I'm stuck with hordes of log_amx() and fakeclients)

I'm having some problems with getting them to fire, though ...

I should be able to force an attack by setting their "buttons" in FM, but that's not the real problem atm.

I just can't get them to equip a weapon at all, and it's really annoying me.

How would you get the FakeClient to "equip" a weapon ... that is, have it so that when they fire, they fire that weapon, and cs_get_user_weapon will return it as their current weapon.

Thanks.

On a related note (came across this while testing):
1) What are the real differences between fakeclients and real clients for AMX/CS?
2) What is the difference between client_cmd() and engclient_cmd() ?
purple_pixie is offline
_Master_
Senior Member
Join Date: Dec 2006
Old 09-03-2007 , 11:09   Re: FakeClients - specifically their weapons
Reply With Quote #2

1) None... with minor exceptions...
2) simply put: client_cmd() is used to "set" a client attribute (ex. you would do a client_cmd(id, "name", "whatever") to force a name change), while engclient_cmd() is used for "pure" commands (you would do an engclient_cmd(id, "drop") to force the player to drop the current weapon). Mostly you would use engclient_cmd() if the command has no arguments. Note that you cannot control your player with either of them. Movement, combat, etc. actions are handled in another way.

For the problem at hand: you would have to give the weapon first and make it the current weapon.

If you'r unable to test it "live" the you should use a message-logger.
There was a tut about this a while ago... I can't find it atm...

Last edited by _Master_; 09-03-2007 at 11:15.
_Master_ is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 09-04-2007 , 04:15   Re: FakeClients - specifically their weapons
Reply With Quote #3

Quote:
For the problem at hand: you would have to give the weapon first and make it the current weapon.
In answer to the question "how do I make a weapon the current weapon" ... oh, you're a lot of help :-D

I don't think I need a message-logger as such (at least right now) - I'm spawning a bot, then on a task trying to give / set its weapon and amx_log'ing a get_user_weapon().

I can handle most "viewing" of the game with amx_log.

From reading other plugins' code, to force a real player to equip a specific weapon is just its name.
e.g. englient_cmd(id,"weapon_knife") but this doesn't work on fake ones :-(

And as for the movement, combat and actions - I'd do that with RunPlayerMove and the "buttons" bit field, right?

Thanks again.

p.s. anyone know a straight answer to "how do you force a fakeclient to equip a weapon?"
(but feel free to reply to anything else mentioned)
purple_pixie is offline
_Master_
Senior Member
Join Date: Dec 2006
Old 09-04-2007 , 05:54   Re: FakeClients - specifically their weapons
Reply With Quote #4

Right. My bad.

Spaw the weapon, set it solid, force a touch with your fake player. The code for this is much like the one for transfer_user_gun() from VEN's Fakemeta Utilities.

engclient_cmd(id, ""weapon_x") is used to force the player to make that weapon the current one. This implies that the player must have it first.

You'll find the answers (at least most of them) if you take a look into Potti

Last edited by _Master_; 09-04-2007 at 05:57.
_Master_ is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 09-04-2007 , 07:42   Re: FakeClients - specifically their weapons
Reply With Quote #5

Well it just doesn't work.
Hmmph.

I read through Potti, and I can see that the method is again 'engclient_cmd(id,"weapon_deagle")' to equip a deagle ...

The code I used is this:
(cs_createbot() is a fully functional routine to create a fakeclient and put them in the server. Returns playerid )
Code:
{     new id = cs_createbot()     strip_user_weapons(id)     give_item(id,"weapon_deagle")     engclient_cmd(id,"weapon_deagle")     new clip,ammo;     log_amx("weapon: %i", get_user_weapon(id,clip,ammo) ) }
And with 1 second tasks between each of those functions, but it makes no odds - "weapon: 0" is invariably logged.

Any ideas?

(Thanks again, btw)
purple_pixie is offline
fxfighter
Veteran Member
Join Date: Feb 2007
Location: Trollhättan
Old 09-04-2007 , 10:49   Re: FakeClients - specifically their weapons
Reply With Quote #6

http://forums.alliedmods.net/showthr...&highlight=botthe tutorial abut how to make a bot/npc and equip it whit gun...
__________________
If one of my plugins become broken, contact me by mail. [email protected]
fxfighter is offline
Send a message via MSN to fxfighter
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 09-04-2007 , 11:34   Re: FakeClients - specifically their weapons
Reply With Quote #7

I could give the model a weapon, no hassle.

I want the player to actually equip the weapon, not just look like it does.

Unless of course I've just mis-read TS's whole thread and it does actually do this ...
purple_pixie 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 18:12.


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