AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   User can change map ;-) but i need help (https://forums.alliedmods.net/showthread.php?t=54056)

grifter 04-16-2007 03:18

User can change map ;-) but i need help
 
Code:

#include <amxmodx>
#include <amxmisc>

new minimumwait=1

public cm(id) {
 new timeleft = get_timeleft()
 new ziom[32]
 get_user_name(id,ziom,31)
 new Float:minutesleft=float(timeleft)/60.0
 new Float:currentlimit=get_cvar_float("mp_timelimit")
 new Float:minutesplayed=currentlimit-minutesleft
 new wait
 wait=minimumwait

 if (get_playersnum() > 2)
  {
  return PLUGIN_CONTINUE
  }

 if((minutesplayed+0.5)<(float(wait)))
  {
      if(float(wait)-0.5-minutesplayed>0.0)
        client_print(id,print_chat,"%s, You must wait %d min",
            ziom,(floatround(float(wait)+0.5-minutesplayed)>0)?(floatround(float(wait)+0.5-minutesplayed)):(1))
      else
        client_print(id,print_chat,"Less than 60 sec")
      if ((get_user_flags(id)&ADMIN_MAP))
        console_print(id,"%s, You are admin ;-)",ziom)
      return PLUGIN_CONTINUE
  }

 server_cmd("amx_map de_dust2")
 return PLUGIN_CONTINUE
}


public plugin_init() {

    register_plugin("changemaps by user","0.1beta","Grifter")
    register_clcmd("say /changemap","cm",0,"- changemap to de_dust2")
}

i wrote this, some code are from deagsmapmanage230b ;-)

and everything work, but i dont know how to do something like that:

say /changemap map_name
so user can change to any map not only one map defined on source ;-)

Dark Kingdom 04-16-2007 08:08

Re: User can change map ;-) but i need help
 
PHP Code:

register_clcmd("say /changemap""map_change"); 


Drak 04-16-2007 08:23

Re: User can change map ;-) but i need help
 
Quote:

Originally Posted by Dark Kingdom (Post 465693)
PHP Code:

register_clcmd("say /changemap""map_change"); 


Well that's not gonna help him...
Code:
public change_map(id) {      new arg[34]      read_argv(1,arg,32)      if(equali(arg,"")) {            // Do stuff, if needed.            return PLUGIN_HANDLED      }      new mapname[35]      formatex(mapname,34,"%s",arg)      server_cmd(mapname);      return PLUGIN_HANDLED }
This will obviously allow anyone to use the command, and I don't think it's needed to format the "mapname" string, but whatever.


All times are GMT -4. The time now is 06:45.

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