AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Task only if the user is connected (https://forums.alliedmods.net/showthread.php?t=92639)

TitANious 05-17-2009 16:04

Task only if the user is connected
 
How could this be solved? I need it for my mod, but the way i planned did not work..

Arkshine 05-17-2009 16:07

Re: Task only if the user is connected
 
Don't understand what you want to do, but to check if an user is connected, use is_user_connected().

TitANious 05-17-2009 16:10

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

[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]

hleV 05-17-2009 16:40

Re: Task only if the user is connected
 
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?

TitANious 05-17-2009 16:41

Re: Task only if the user is connected
 
Yes :) It's look like, so yes :D Thanks

TitANious 05-17-2009 16:57

Re: Task only if the user is connected
 
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 :(

DarkGod 05-17-2009 16:59

Re: Task only if the user is connected
 
You had a typo in your original code so make it TASK_MENU_DISLPAY_TIME.
I don't know about the others, though.

joaquimandrade 05-17-2009 23:22

Re: Task only if the user is connected
 
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


One 05-18-2009 02:57

Re: Task only if the user is connected
 
&
PHP Code:

#define TASK_MENU_DISPLAY_TIME xx                // xx in sec. 


-=hunter=- 05-18-2009 06:14

Re: Task only if the user is connected
 
Maybe client_putinserver?


All times are GMT -4. The time now is 01:24.

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