a friend of mine gave me the code for his plugin, wich was untestet, he helped me a bit trying to make it work as i wanted it to, but without any luck. i am trying to port kz maps from cs to tfc, without having to edit each and every map file. but the thing is, it converts all maps, not just the kz ones
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
new bool:first
public plugin_precache() {
register_plugin(PLUGIN, VERSION, AUTHOR)
new mapname[42]
get_mapname(mapname,41)
if(!find_ent_by_class(-1,"info_tfdetect")) {
register_forward(FM_KeyValue, "getkeyvalue")
}
else {
pause("a")
}
}
public getkeyvalue(ent, kvdid) {
if (pev_valid(ent)) {
new keyname[32]
get_kvd(kvdid, KV_KeyName, keyname, 31)
if(equali(keyname,"origin") && !first) {
new origin[20]
get_kvd(kvdid,KV_Value,origin,19)
new tfd = create_entity("info_tfdetect")
entity_set_string(tfd, EV_SZ_classname, "info_tfdetect")
DispatchKeyValue(tfd,"origin",origin)
DispatchKeyValue(tfd,"maxammo_shells","-1")
DispatchKeyValue(tfd,"team1_name","Climbers")
DispatchKeyValue(tfd,"number_of_teams","1")
DispatchSpawn(tfd)
first = true
}
new classname[32]
get_kvd(kvdid, KV_ClassName, classname, 31)
if (equali(classname, "info_player_deathmatch") || equali(classname, "info_player_start")) {
if(equali(keyname,"origin")) {
new origin[20]
get_keyvalue(ent,"origin",origin,19)
get_kvd(kvdid,KV_Value,origin,19)
new spwn = create_entity("info_player_teamspawn")
entity_set_string(spwn, EV_SZ_classname, "info_player_teamspawn")
DispatchKeyValue(spwn,"origin",origin)
DispatchKeyValue(spwn,"team_no","1")
DispatchSpawn(spwn)
}
}
}
return FMRES_IGNORED
}
if anyone has any ideas about why it doesnt work, please answer my call, cause i have no knowledge in this kinda coding, i can edit maps manually and batch script, thats it.
__________________