Raised This Month: $ Target: $400
 0% 

Handling information with set_task


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 04-21-2011 , 04:32   Handling information with set_task
Reply With Quote #1

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... )
reinert is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 04-21-2011 , 07:38   Re: Handling information with set_task
Reply With Quote #2

PHP Code:
set_task(5.0"NextMap"555reststrlen(rest)) 
__________________
Impossible is Nothing
Sylwester is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-21-2011 , 08:41   Re: Handling information with set_task
Reply With Quote #3

Quote:
Originally Posted by Sylwester View Post
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 ) ) 
__________________

Last edited by Bugsy; 04-21-2011 at 09:00.
Bugsy is online now
reinert
Veteran Member
Join Date: Feb 2007
Old 04-21-2011 , 09:33   Re: Handling information with set_task
Reply With Quote #4

Thanks, works perfectly.
reinert 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 19:47.


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