AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Code Help] Nextmap (https://forums.alliedmods.net/showthread.php?t=212402)

smekeru 04-02-2013 06:08

[Code Help] Nextmap
 
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



kiki33hun 04-02-2013 06:57

Re: [Code Help] Nextmap
 
Quote:

Originally Posted by smekeru (Post 1924941)
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



smekeru 04-02-2013 07:01

Re: [Code Help] Nextmap
 
Argument type mismatch :

Code:

        set_cvar_num("amx_nextmap", insert)

bael 04-02-2013 07:11

Re: [Code Help] Nextmap
 
insert is a string
set_cvar_num - Sets a cvar with integer value

so maybe try with set_cvar_string

Sn!ff3r 04-03-2013 16:15

Re: [Code Help] Nextmap
 
http://forums.alliedmods.net/showthread.php?t=79258


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

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