Raised This Month: $ Target: $400
 0% 

"set_user_time" for bots


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
portocala
Member
Join Date: Jun 2010
Old 07-27-2010 , 17:45   "set_user_time" for bots
Reply With Quote #1

Yes, I know that this function doesn't exists, bot how can I set the uptime for bots ? It is currently used the server uptime.

More details:

get_user_time(player) = normal uptime... since the player joined
get_user_time(bot) = server uptime

and I want to be the uptime since the bot was created..

If it is possible.. I saw it is.

Thank you!
portocala is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-27-2010 , 17:54   Re: "set_user_time" for bots
Reply With Quote #2

I don't understand why you called "set_user_time" in the title and "get_user_time" in the thread, so i don't understand at all what you want.

If you want to use get_user_time() to bot, you tried like yo do with a player? using the index of the bot to the native?
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Gadzislaw007
Senior Member
Join Date: Nov 2009
Old 07-27-2010 , 21:27   Re: "set_user_time" for bots
Reply With Quote #3

Quote:
and I want to be the uptime since the bot was created..
Well...
You have to start timer, when player joins. That's all I think...
Define get_gametime, when player joins and then check time played by defined gametime - current gametime.

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new Float: gametime[33]

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_clcmd("say /time", "cmd_timer");
}

public player_connect(id)
{
gametime[id] =  get_gametime ( )
}

public cmd_timer(id)
{
new Float: szSec[33]
szSec[id] = (get_gametime ( ) - gametime[id])
client_print(id,print_chat, "You're playing already for %s seconds", szSec[id])
}

public player_disconnect(id)
{
gametime[id] =  0.00
}
I haven't test it, but it compiles.

Last edited by Gadzislaw007; 07-27-2010 at 21:57.
Gadzislaw007 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-27-2010 , 23:52   Re: "set_user_time" for bots
Reply With Quote #4

Just made a few corrections. Untested
PHP Code:
#include <amxmodx>

new Floatg_fGameTime33 ];

public 
plugin_init()
{
    
register_clcmd("say /time""cmd_timer");
}

public 
client_connectid )
{
    
g_fGameTimeid ] = get_gametime();
}

public 
client_disconnectid )
{
    
g_fGameTimeid ] = 0.0;
}

public 
cmd_timerid )
{
    new 
FloatfSec = ( get_gametime() - g_fGameTimeid ] );
    
client_printid print_chat "You're playing already for %f seconds" fSec );

__________________

Last edited by Bugsy; 07-28-2010 at 00:03.
Bugsy is offline
portocala
Member
Join Date: Jun 2010
Old 07-28-2010 , 02:55   Re: "set_user_time" for bots
Reply With Quote #5

It is "set_user_time" (with quotes, because the function doesn't exist) because this is what I want to do... a function like this!

The uptime must be 'native'. So if I call get_user_time(bot), the result must be the real uptime since the bot was created.

Recap:
I suppose that there are 2 ways to do it:

1. Find a way to create the bot with native uptime, using real time since he was created and not the server uptime;

or

2. Find a way to set bot uptime (something similar with "set_user_time", rewriting the original uptime), so when I call get_user_time(bot), the result will be the number in seconds since the bot was created.

I hope you understand, I want the uptime to be native (when you type "status" and others).

Thank you again... and thanks for that code, but this is not what I want.
portocala is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-28-2010 , 13:53   Re: "set_user_time" for bots
Reply With Quote #6

Maybe a macro like this? This will return the calculated time for bots and get_user_time() for real players. This would be used in conjunction with my code above.

PHP Code:
#define get_user_time2(%1) (is_user_bot(%1) ? float_round(get_gametime()-g_fGameTime[%1]):get_user_time(%1)) 
__________________

Last edited by Bugsy; 07-28-2010 at 16:35.
Bugsy is offline
portocala
Member
Join Date: Jun 2010
Old 07-29-2010 , 15:09   Re: "set_user_time" for bots
Reply With Quote #7

No.

If I type status, then the bot's uptime is still the server uptime, not the real one.
I don't need to know the uptime, this is simple. I need to show a real or any uptime (different) from bot to bot - when I type status.

Ex:

Original:
Code:
#      name userid uniqueid frag time ping loss adr
# 1 "bot1" 1 BOT   6 07:58    0    0
# 2 "bot2" 2 BOT  25 07:58    0    0
# 3    "bot3" 3 BOT  17 07:58    0    0
07:58 is the bot's uptime and server too - you know, obviously...

I want to transform it in something like this:
Code:
#      name userid uniqueid frag time ping loss adr
# 1 "bot1" 1 BOT   6 02:01    0    0
# 2 "bot2" 2 BOT  25 03:21    0    0
# 3    "bot3" 3 BOT  17 07:21    0    0
Real, random... no matter!
portocala is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-29-2010 , 16:10   Re: "set_user_time" for bots
Reply With Quote #8

I get it, but why do you want to alter the time internally? Using the above macro will give you exactly how long an individual player or bot has been on the server.
__________________
Bugsy is offline
portocala
Member
Join Date: Jun 2010
Old 07-29-2010 , 16:38   Re: "set_user_time" for bots
Reply With Quote #9

I don't need the time... It is for appearance.
The uptime appears in many places. If it won't be the same, then other players will think that those are real players (the score is also modified).

It is possible, but I don't know how... no need help with scripting, I'm doing well. I just need a tip.

Anyway, thank you so far!
portocala is offline
portocala
Member
Join Date: Jun 2010
Old 08-01-2010 , 04:36   Re: "set_user_time" for bots
Reply With Quote #10

Nothing ?
portocala is offline
Reply


Thread Tools
Display Modes

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 00:10.


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