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

How to get keyvalue for trigger_changelevel?


Post New Thread Reply   
 
Thread Tools Display Modes
MihaiGamerXD
Member
Join Date: Aug 2018
Old 12-10-2018 , 11:02   Re: How to get keyvalue for trigger_changelevel?
Reply With Quote #11

But the string?
MihaiGamerXD is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 12-10-2018 , 13:36   Re: How to get keyvalue for trigger_changelevel?
Reply With Quote #12

sry, read next post
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 12-10-2018 at 13:38.
JocAnis is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 12-10-2018 , 13:38   Re: How to get keyvalue for trigger_changelevel?
Reply With Quote #13

Quote:
Originally Posted by MihaiGamerXD View Post
PHP Code:
public pfn_keyvalue(entid) {
    
get_pdata_string(entid,73,mapname,31,1,0)

how can plugin know for which ent should he search that string? its probably added the last loaded entity, so who knows what is it...better try to find entity by class and then use that option
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
MihaiGamerXD
Member
Join Date: Aug 2018
Old 04-10-2019 , 05:06   Re: How to get keyvalue for trigger_changelevel?
Reply With Quote #14

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!
MihaiGamerXD is offline
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 online now
Reply



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 18:40.


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