View Single Post
DarthMan
Veteran Member
Join Date: Aug 2011
Old 04-15-2019 , 04:05   Re: How to get keyvalue for trigger_changelevel?
Reply With Quote #15

Quote:
Originally Posted by MihaiGamerXD View Post
I tried this:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

new mapname[32]

public 
plugin_init() {
    
register_plugin("Change Level""1.0""MihaiGamerXD")
    
RegisterHam(Ham_Touch,"trigger_changelevel","ChangeLevel")
}

public 
ChangeLevel() {
    
server_cmd("changelevel %s",mapname)
}

public 
pfn_keyvalue(entid) {
    
find_ent_by_class(entid,"trigger_changelevel")
    
mapname[entid] = get_pdata_string(entid,73,mapname,31,1,0)

Still doesn't work!
If you want to do it specifically for trigger_changelevel, you could also use the FM_KeyValue forward, check if entity is valid then get it's classname by using get_kvd with KV_ClassName as keyvalue member, if it equals to trigger_changelevel, use get_kvd again with KV_KeyName and check if the key is map, then, if it is, get the value with KV_Value. You can then store this in a global array and use engine_changelevel native to change to that map.

Last edited by DarthMan; 04-15-2019 at 04:05.
DarthMan is offline