Raised This Month: $ Target: $400
 0% 

Task only if the user is connected


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-17-2009 , 16:04   Task only if the user is connected
Reply With Quote #1

How could this be solved? I need it for my mod, but the way i planned did not work..
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-17-2009 , 16:07   Re: Task only if the user is connected
Reply With Quote #2

Don't understand what you want to do, but to check if an user is connected, use is_user_connected().
Arkshine is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-17-2009 , 16:10   Re: Task only if the user is connected
Reply With Quote #3

I meaned, the task is only you used once, when the user is connected, is it clear enough ? I can try to explain it more, but i think that it would be hard

[EDIT]

Maybe this?
PHP Code:
public fwHamPlayerSpawnPost(id)
{
    if(
get_pcvar_num(g_Enable) == 0)
        return 
HAM_SUPERCEDE;
    if(
get_pcvar_num(gCvarMenuOpen) == 1)
    {
        
set_task(TASK_MENU_DISLPAY_TIME"choose_menu"id);

        return 
HAM_IGNORED;
    }
    if((!
is_user_connected(id)) && get_pcvar_num(gCvarMenuOpen) == 2)
    {
        
set_task(TASK_MENU_DISLPAY_TIME"choose_menu"id);

        return 
HAM_IGNORED;
    }

[/EDIT]
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.

Last edited by TitANious; 05-17-2009 at 16:14.
TitANious is offline
Send a message via MSN to TitANious
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-17-2009 , 16:40   Re: Task only if the user is connected
Reply With Quote #4

Code:
new g_bJustConnected[33];   public client_connect(iCl)         g_bJustConnected[33] = true;   public fnFunction(iCl) {         // Check if player has just connected         if (g_bJustConnected[iCl])         {                 // Player has just connected, set the task                 set_task(TASK_MENU_DISPLAY_TIME, "choose_menu", iCl);                   // Now set that player is no longer "just connected"                 g_bJustConnected[iCl] = false;         } }
Is this what you want?
__________________
hleV is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-17-2009 , 16:41   Re: Task only if the user is connected
Reply With Quote #5

Yes It's look like, so yes Thanks
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-17-2009 , 16:57   Re: Task only if the user is connected
Reply With Quote #6

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler. Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team Warning: Tag mismatch on line 352 Error: Array index out of bounds (variable "g_bJustConnected") on line 361 Error: Undefined symbol "TASK_MENU_DISPLAY_TIME" on line 374 Warning: Expression has no effect on line 374 Warning: Expression has no effect on line 374 Error: Expected token: ";", but found ")" on line 374 Error: Invalid expression, assumed zero on line 374 Error: Too many error messages on one line on line 374 Compilation aborted. 5 Errors. Could not locate output file C:\Users\Jacob\Desktop\WesternMod.amx (compile failed).
It's seems not to work
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 05-17-2009 , 16:59   Re: Task only if the user is connected
Reply With Quote #7

You had a typo in your original code so make it TASK_MENU_DISLPAY_TIME.
I don't know about the others, though.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 05-17-2009 , 23:22   Re: Task only if the user is connected
Reply With Quote #8

Hlev code has
PHP Code:
public client_connect(iCl)
        
g_bJustConnected[33] = true

it should be

PHP Code:
public client_connect(iCl)
        
g_bJustConnected[iCl] = true
__________________
joaquimandrade is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-18-2009 , 02:57   Re: Task only if the user is connected
Reply With Quote #9

&
PHP Code:
#define TASK_MENU_DISPLAY_TIME xx                // xx in sec. 
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
-=hunter=-
Senior Member
Join Date: Jul 2008
Old 05-18-2009 , 06:14   Re: Task only if the user is connected
Reply With Quote #10

Maybe client_putinserver?
-=hunter=- is offline
Send a message via ICQ to -=hunter=- Send a message via Skype™ to -=hunter=-
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 01:24.


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