Raised This Month: $32 Target: $400
 8% 

[Code Help] Nextmap


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smekeru
Junior Member
Join Date: Sep 2009
Old 04-02-2013 , 06:08   [Code Help] Nextmap
Reply With Quote #1

Hello.

I try wrote a code that allows me to set the next map by console command.

What i did wrong ?

PHP Code:
#include <amxmodx>
#include <amxmisc>

new const NAME[] = "Nextmap"
new const VERSION[] = "1.0"
new const AUTHOR[] = "Bogdan"

public plugin_init()
{   
   
register_plugin(NAMEVERSIONAUTHOR)     
   
register_concmd("amx_nextmap","nextmap_code",ADMIN_BAN,"Set nextmap")

}
public 
nextmap_code(id,level,cid)
{     
   if(!
cmd_access(idlevelcid2))   
   {      
      return 
PLUGIN_HANDLED   
   
}   
   
   new 
insertname[32]  
        
get_user_name(idname31)
        
set_cvar_num("amx_nextmap"insert)       
        
client_print(0,print_chat,"[AMXX] Admin %s : Set next map to %s"nameinsert)        
 return 
PLUGIN_HANDLED

smekeru is offline
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 04-02-2013 , 06:57   Re: [Code Help] Nextmap
Reply With Quote #2

Quote:
Originally Posted by smekeru View Post
Hello.

I try wrote a code that allows me to set the next map by console command.

What i did wrong ?

PHP Code:
#include <amxmodx>
#include <amxmisc>

new const NAME[] = "Nextmap"
new const VERSION[] = "1.0"
new const AUTHOR[] = "Bogdan"

public plugin_init()
{   
   
register_plugin(NAMEVERSIONAUTHOR)     
   
register_concmd("amx_nextmap","nextmap_code",ADMIN_BAN,"Set nextmap")

}
public 
nextmap_code(id,level,cid)
{     
   if(!
cmd_access(idlevelcid2))   
   {      
      return 
PLUGIN_HANDLED   
   
}   
   
   new 
insertname[32]  
        
get_user_name(idname31)
        
set_cvar_num("amx_nextmap"insert)       
        
client_print(0,print_chat,"[AMXX] Admin %s : Set next map to %s"nameinsert)        
 return 
PLUGIN_HANDLED

Insert variable is empty. Try:
PHP Code:
#include <amxmodx>
#include <amxmisc>

new const NAME[] = "Nextmap"
new const VERSION[] = "1.0"
new const AUTHOR[] = "Bogdan"

public plugin_init()
{   
   
register_plugin(NAMEVERSIONAUTHOR)     
   
register_concmd("amx_nextmap","nextmap_code",ADMIN_BAN,"Set nextmap")

}
public 
nextmap_code(id,level,cid)
{     
   if(!
cmd_access(idlevelcid2))   
   {      
      return 
PLUGIN_HANDLED   
   
}   
   
   new 
insert[120], name[32]  
        
get_user_name(idname31)
       
read_argv(1insert119)
        
set_cvar_num("amx_nextmap"insert)       
        
client_print(0,print_chat,"[AMXX] Admin %s : Set next map to %s"nameinsert)        
 return 
PLUGIN_HANDLED

__________________
kiki33hun is offline
smekeru
Junior Member
Join Date: Sep 2009
Old 04-02-2013 , 07:01   Re: [Code Help] Nextmap
Reply With Quote #3

Argument type mismatch :

Code:
        set_cvar_num("amx_nextmap", insert)
smekeru is offline
bael
Junior Member
Join Date: Oct 2012
Old 04-02-2013 , 07:11   Re: [Code Help] Nextmap
Reply With Quote #4

insert is a string
set_cvar_num - Sets a cvar with integer value

so maybe try with set_cvar_string
bael is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 04-03-2013 , 16:15   Re: [Code Help] Nextmap
Reply With Quote #5

http://forums.alliedmods.net/showthread.php?t=79258
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
Reply


Thread Tools
Display Modes

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 17:47.


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