AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Handling information with set_task (https://forums.alliedmods.net/showthread.php?t=155372)

reinert 04-21-2011 04:32

Handling information with set_task
 
Hey, I've a code like when admin types !map <map_name> it should changelevel after 5seconds so its like:

PHP Code:

if(equali(cmd"!map"))
    {
        if(
is_map_valid(rest))
        {
            
set_task(5.0"NextMap"555rest)
            
client_printc(0"!g[ CLAN MATCH ]!n Switching map to %s"rest)
        }
        else
        {
            
client_printc(id"!g[ CLAN MATCH ]!n Map %s isn't valid"rest)
        }
        return 
PLUGIN_HANDLED_MAIN;
    }

public 
NextMap(MapName[])
{
    
server_cmd("changelevel %s"MapName)


But it's not working. ( If I try to change it manually with changelevel de_dust2, then it works... )

Sylwester 04-21-2011 07:38

Re: Handling information with set_task
 
PHP Code:

set_task(5.0"NextMap"555reststrlen(rest)) 


Bugsy 04-21-2011 08:41

Re: Handling information with set_task
 
Quote:

Originally Posted by Sylwester (Post 1454718)
PHP Code:

set_task(5.0"NextMap"555reststrlen(rest)) 


It's more proper to use sizeof() since strings are null-terminated and the null-char would not be 'sent' using strlen(). Either way probably works, though.

PHP Code:

set_task5.0 "NextMap" 555 rest sizeofrest ) ) 


reinert 04-21-2011 09:33

Re: Handling information with set_task
 
Thanks, works perfectly.


All times are GMT -4. The time now is 19:47.

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