Add change_level() native.
This commit is contained in:
parent
69fc7eeabe
commit
10d5c8e9ad
|
@ -2574,6 +2574,18 @@ static cell AMX_NATIVE_CALL change_task(AMX *amx, cell *params)
|
||||||
return g_tasksMngr.changeTasks(params[1], params[3] ? 0 : amx, flNewTime);
|
return g_tasksMngr.changeTasks(params[1], params[3] ? 0 : amx, flNewTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL change_level(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
int length;
|
||||||
|
const char* new_map = get_amxstring(amx, params[1], 0, length);
|
||||||
|
|
||||||
|
// Same as calling "changelevel" command but will trigger "server_changelevel" AMXX forward as well.
|
||||||
|
// Filling second param will call "changelevel2" command, but this is not usable in multiplayer game.
|
||||||
|
g_pEngTable->pfnChangeLevel(new_map, NULL);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL task_exists(AMX *amx, cell *params) /* 1 param */
|
static cell AMX_NATIVE_CALL task_exists(AMX *amx, cell *params) /* 1 param */
|
||||||
{
|
{
|
||||||
return g_tasksMngr.taskExists(params[1], params[2] ? 0 : amx);
|
return g_tasksMngr.taskExists(params[1], params[2] ? 0 : amx);
|
||||||
|
@ -4838,6 +4850,7 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
|
||||||
{"callfunc_push_str", callfunc_push_str},
|
{"callfunc_push_str", callfunc_push_str},
|
||||||
{"callfunc_push_array", callfunc_push_array},
|
{"callfunc_push_array", callfunc_push_array},
|
||||||
{"change_task", change_task},
|
{"change_task", change_task},
|
||||||
|
{"change_level", change_level},
|
||||||
{"client_cmd", client_cmd},
|
{"client_cmd", client_cmd},
|
||||||
{"client_print", client_print},
|
{"client_print", client_print},
|
||||||
{"client_print_color", client_print_color},
|
{"client_print_color", client_print_color},
|
||||||
|
|
|
@ -654,7 +654,7 @@ public cmdSlap(id, level, cid)
|
||||||
|
|
||||||
public chMap(map[])
|
public chMap(map[])
|
||||||
{
|
{
|
||||||
server_cmd("changelevel %s", map)
|
change_level(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdMap(id, level, cid)
|
public cmdMap(id, level, cid)
|
||||||
|
|
|
@ -84,6 +84,19 @@ native precache_sound(const name[]);
|
||||||
/* Precaches any file. */
|
/* Precaches any file. */
|
||||||
native precache_generic(const szFile[]);
|
native precache_generic(const szFile[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes map.
|
||||||
|
*
|
||||||
|
* @note This calls the pfnChangelLevel engine function.
|
||||||
|
* @note This has the same behavior as calling "changelevel" server command,
|
||||||
|
* but this will trigger properly server_changelevel() forward.
|
||||||
|
*
|
||||||
|
* @aparam map The map name to change.
|
||||||
|
*
|
||||||
|
* @noreturn
|
||||||
|
*/
|
||||||
|
native change_level(const map[]);
|
||||||
|
|
||||||
/* Sets info for player. */
|
/* Sets info for player. */
|
||||||
native set_user_info(index,const info[],const value[]);
|
native set_user_info(index,const info[],const value[]);
|
||||||
|
|
||||||
|
|
|
@ -321,7 +321,7 @@ public cmdMapsMenu(id, level, cid)
|
||||||
}
|
}
|
||||||
|
|
||||||
public delayedChange(mapname[])
|
public delayedChange(mapname[])
|
||||||
server_cmd("changelevel %s", mapname)
|
change_level(mapname)
|
||||||
|
|
||||||
public actionVoteMapMenu(id, key)
|
public actionVoteMapMenu(id, key)
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,7 +118,7 @@ public delayedChange(param[])
|
||||||
if (g_mp_chattime) {
|
if (g_mp_chattime) {
|
||||||
set_pcvar_float(g_mp_chattime, get_pcvar_float(g_mp_chattime) - 2.0)
|
set_pcvar_float(g_mp_chattime, get_pcvar_float(g_mp_chattime) - 2.0)
|
||||||
}
|
}
|
||||||
server_cmd("changelevel %s", param)
|
change_level(param)
|
||||||
}
|
}
|
||||||
|
|
||||||
public changeMap()
|
public changeMap()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user