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

[HELP] to write func


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
preepunk
Member
Join Date: Jul 2009
Location: Universe, Milky Way
Old 08-20-2010 , 12:38   [HELP] to write func
Reply With Quote #1

Here is the code of get_user_time, so if i call it it will return time that player spent on the server

Code:
static cell AMX_NATIVE_CALL get_user_time(AMX *amx, cell *params) /* get_user_time(id,flag) 0-all, 1 without connected*/
{
  int index = params[1];
  if (index<1||index>gpGlobals->maxClients)
    return 0;
  CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
  if (pPlayer->ingame){
    int time = (int)(gpGlobals->time - (params[2] ? pPlayer->playtime : pPlayer->time));
    return time;
  }
  return 0;
}
I need to modify it and to get a
set_user_time
so that i will set_user_time(id,flag,time_in_seconds)
i know that i should use ENTITY_SET_KEYVALUE
but i really dont know how
please help its not so difficult 2 you)
PM or there

Last edited by preepunk; 08-20-2010 at 12:45.
preepunk is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-20-2010 , 16:11   Re: [HELP] to write func
Reply With Quote #2

Code:
static cell AMX_NATIVE_CALL set_user_time(AMX *amx, cell *params) /* set_user_time(id,time) 0-all, seconds*/
{
  int index = params[1];
  if (index<1||index>gpGlobals->maxClients)
    return 0;
  CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
  if (pPlayer->ingame){
    float time = amx_ctof(params[2]);
    float connecttime = pPlayer->playtime - pPlayer->time;
    pPlayer->playtime = gpGlobals->time - time;
    pPlayer->time = pPlayer->playtime - connecttime;
    return 1;
  }
  return 0;
}
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
preepunk
Member
Join Date: Jul 2009
Location: Universe, Milky Way
Old 09-03-2010 , 14:57   Re: [HELP] to write func
Reply With Quote #3

thanx very much!!
preepunk is offline
Gauda
Junior Member
Join Date: Mar 2010
Old 11-30-2010 , 11:00   Re: [HELP] to write func
Reply With Quote #4

Reference to an already compiled dll/so can give?
Gauda is offline
zeus
Senior Member
Join Date: Jul 2008
Old 04-09-2013 , 05:37   Re: [HELP] to write func
Reply With Quote #5

What do I have to do to use that function?

Last edited by zeus; 04-09-2013 at 05:37.
zeus 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 14:11.


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