ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.65k stars 617 forks source link

Walkguard %s #2947

Open MatiasGFaria opened 4 years ago

MatiasGFaria commented 4 years ago

Can someone help me with this bug that this plugin has or if they know how I can solve it because honestly it is driving me crazy and I need to solve it

when a player enters the camper area he gets a message% s

https://prnt.sc/txi9wp

Sma:

``` #include #include #include #include #define PLUGIN "WalkGuard" #define VERSION "1.3.2" #define AUTHOR "mogel" /* * fakemeta-version by djmd378 */ enum ZONEMODE { ZM_NOTHING, ZM_CAMPING, ZM_CAMPING_T1, // Team 1 -> e.g. Terrorist ZM_CAMPING_T2, // Team 2 -> e.g. Counter-Terroris ZM_BLOCK_ALL, ZM_KILL, ZM_KILL_T1, // DoD-Unterstützung ZM_KILL_T2 } new zonemode[ZONEMODE][] = { "ZONE_MODE_NONE", "ZONE_MODE_CAMPER", "ZONE_MODE_CAMPER_T1", "ZONE_MODE_CAMPER_T2", "ZONE_MODE_BLOCKING", "ZONE_MODE_CHEATER", "ZONE_MODE_CHEATER_T1", "ZONE_MODE_CHEATER_T2" } new zonename[ZONEMODE][] = { "wgz_none", "wgz_camper", "wgz_camper_t1", "wgz_camper_t2", "wgz_block_all", "wgz_kill", "wgz_kill_t1", "wgz_kill_t2" } new solidtyp[ZONEMODE] = { SOLID_NOT, SOLID_TRIGGER, SOLID_TRIGGER, SOLID_TRIGGER, SOLID_BBOX, SOLID_TRIGGER, SOLID_TRIGGER, SOLID_TRIGGER } new zonecolor[ZONEMODE][3] = { { 255, 0, 255 }, // nichts { 0, 255, 0 }, // Camperzone { 0, 255, 128 }, // Camperzone T1 { 128, 255, 0 }, // Camperzone T2 { 255, 255, 255 }, // alle Blockieren { 255, 0, 0 }, // Kill { 255, 0, 128 }, // Kill - T1 { 255, 128, 0 } // Kill - T2 } #define ZONEID pev_iuser1 #define CAMPERTIME pev_iuser2 new zone_color_aktiv[3] = { 0, 0, 255 } new zone_color_red[3] = { 255, 0, 0 } new zone_color_green[3] = { 255, 255, 0 } // alle Zonen #define MAXZONES 100 new zone[MAXZONES] new maxzones // soviele existieren new index // die aktuelle Zone // Editier-Funktionen new setupunits = 10 // Änderungen an der Größe um diese Einheiten new direction = 0 // 0 -> X-Koorinaten / 1 -> Y-Koords / 2 -> Z-Koords new koordinaten[3][] = { "TRANSLATE_X_KOORD", "TRANSLATE_Y_KOORD", "TRANSLATE_Z_KOORD" } new spr_dot // benötigt für die Lininen new editor = 0 // dieser Spieler ist gerade am erstellen .. Menü verkraftet nur einen Editor new camperzone[33] // letzte Meldung der CamperZone new Float:campertime[33] // der erste Zeitpunkt des eintreffens in die Zone new Float:camping[33] // der letzte Zeitpunkt des campens #define TASK_BASIS_CAMPER 2000 #define TASK_BASIS_SHOWZONES 1000 new pcv_damage new pcv_botdamage new pcv_immunity new pcv_direction new pcv_botdirection new pcv_damageicon // less CPU new slap_direction new slap_botdirection new slap_damage new slap_botdamage new admin_immunity new icon_damage // Damage-Icon enum ROUNDSTATUS { RS_UNDEFINED, RS_RUNNING, RS_FREEZETIME, RS_END, } new ROUNDSTATUS:roundstatus = RS_UNDEFINED public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_cvar("WalkGuard", VERSION, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED) server_cmd("WalkGuard %s", VERSION) pcv_damage = register_cvar("wg_damage", "10") pcv_botdamage = register_cvar("wg_botdamage", "0") // Bot's sind einfach nur dumm ... und können nicht lesen pcv_immunity = register_cvar("wg_immunity", "0") // Admins mit Immunität brauchen nicht pcv_direction = register_cvar("wg_direction", "1") // zufällige Richtung beim Slap pcv_botdirection = register_cvar("wg_botdirection", "1") // dito für Bots pcv_damageicon = register_cvar("wg_damageicon", "262144") // eigentlich ein Pfeil register_menu("MainMenu", -1, "MainMenuAction", 0) register_menu("EditMenu", -1, "EditMenuAction", 0) register_menu("KillMenu", -1, "KillMenuAction", 0) // Menu register_clcmd("walkguardmenu", "InitWalkGuard", ADMIN_RCON, " - open the WalkGuard-Menu") // Sprache register_dictionary("walkguard.txt") // Einstelleungen der Variablen laden register_event("HLTV", "Event_FreezeTime", "a", "1=0", "2=0") register_logevent("Event_RoundStart", 2, "1=Round_Start") register_logevent("Event_RoundEnd", 2, "1=Round_End") register_forward(FM_Touch, "fw_touch") // Zonen nachladen set_task(1.0, "LoadWGZ") } public plugin_precache() { precache_model("models/gib_skull.mdl") spr_dot = precache_model("sprites/dot.spr") } public client_disconnect(player) { // aus irgend welchen Gründen ist der Spieler einfach wech........ if (player == editor) HideAllZones() } public Event_FreezeTime() { roundstatus = RS_FREEZETIME } public Event_RoundStart() { roundstatus = RS_RUNNING // CPU schonen und die Variablen am Anfang gleich merken slap_damage = get_pcvar_num(pcv_damage) slap_direction = get_pcvar_num(pcv_direction) slap_botdamage = get_pcvar_num(pcv_botdamage) slap_botdirection = get_pcvar_num(pcv_botdirection) admin_immunity = get_pcvar_num(pcv_immunity) icon_damage = get_pcvar_num(pcv_damageicon) } public Event_RoundEnd() { roundstatus = RS_END } // ----------------------------------------------------------------------------------------- // // WalkGuard-Action // // -> hier ist alles was passiert // // ----------------------------------------------------------------------------------------- public fw_touch(zone, player) { if (editor) return FMRES_IGNORED if (!pev_valid(zone) || !is_user_connected(player)) return FMRES_IGNORED static classname[33] pev(player, pev_classname, classname, 32) if (!equal(classname, "player")) return FMRES_IGNORED pev(zone, pev_classname, classname, 32) if (!equal(classname, "walkguardzone")) return FMRES_IGNORED if (roundstatus == RS_RUNNING) ZoneTouch(player, zone) return FMRES_IGNORED } public ZoneTouch(player, zone) { new zm = pev(zone, ZONEID) new userteam = get_user_team(player) // Admin mit Immunity brauchen nicht if (admin_immunity && (get_user_flags(player) & ADMIN_IMMUNITY)) return // Kill Bill if ( (ZONEMODE:zm == ZM_KILL) || ((ZONEMODE:zm == ZM_KILL_T1) && (userteam == 1)) || ((ZONEMODE:zm == ZM_KILL_T2) && (userteam == 2)) ) set_task(0.1, "ZoneModeKill", player) // Camping if ( (ZONEMODE:zm == ZM_CAMPING) || ((ZONEMODE:zm == ZM_CAMPING_T1) && (userteam == 1)) || ((ZONEMODE:zm == ZM_CAMPING_T2) && (userteam == 2)) ) { if (!camping[player]) { client_print(player, print_center, "%L", player, "WALKGUARD_CAMPING_INIT") // Gratulation ... Du wirst beobachtet camperzone[player] = zone campertime[player] = get_gametime() camping[player] = get_gametime() set_task(0.5, "ZoneModeCamper", TASK_BASIS_CAMPER + player, _, _, "b") } else { // immer fleissig mitzählen camping[player] = get_gametime() } } } public ZoneModeKill(player) { if (!is_user_connected(player) || !is_user_alive(player)) return user_silentkill(player) for(new i = 0; i < 5; i++) client_print(player, print_chat, "[WalkGuard] %L", player, "WALKGUARD_KILL_MESSAGE") client_cmd(player,"speak ambience/thunder_clap.wav") } public ZoneModeCamper(player) { player -= TASK_BASIS_CAMPER if (!is_user_connected(player)) { // so ein Feigling ... hat sich einfach verdrückt ^^ remove_task(TASK_BASIS_CAMPER + player) return } new Float:gametime = get_gametime(); if ((gametime - camping[player]) > 0.5) { // *juhu* ... wieder frei campertime[player] = 0.0 camping[player] = 0.0 remove_task(TASK_BASIS_CAMPER + player) return } new ct = pev(camperzone[player], CAMPERTIME) new left = ct - floatround( gametime - campertime[player]) if (left < 1) { client_print(player, print_center, "%L", player, "WALKGUARD_CAMPING_DAMG") if (is_user_bot(player)) { if (slap_botdirection) RandomDirection(player) fm_fakedamage(player, "camping", float(slap_botdamage), 0) } else { if (slap_direction) RandomDirection(player) fm_fakedamage(player, "camping", float(slap_damage), icon_damage) } } else { client_print(player, print_center, "%L", player, "WALKGUARD_CAMPING_TIME", left) } } public RandomDirection(player) { new Float:velocity[3] velocity[0] = random_float(-256.0, 256.0) velocity[1] = random_float(-256.0, 256.0) velocity[2] = random_float(-256.0, 256.0) set_pev(player, pev_velocity, velocity) } // ----------------------------------------------------------------------------------------- // // Zonenerstellung // // ----------------------------------------------------------------------------------------- public CreateZone(Float:position[3], Float:mins[3], Float:maxs[3], zm, campertime) { new entity = fm_create_entity("info_target") set_pev(entity, pev_classname, "walkguardzone") fm_entity_set_model(entity, "models/gib_skull.mdl") fm_entity_set_origin(entity, position) set_pev(entity, pev_movetype, MOVETYPE_FLY) new id = pev(entity, ZONEID) if (editor) { set_pev(entity, pev_solid, SOLID_NOT) } else { set_pev(entity, pev_solid, solidtyp[ZONEMODE:id]) } fm_entity_set_size(entity, mins, maxs) fm_set_entity_visibility(entity, 0) set_pev(entity, ZONEID, zm) set_pev(entity, CAMPERTIME, campertime) //log_amx("create zone '%s' with campertime %i seconds", zonename[ZONEMODE:zm], campertime) return entity } public CreateNewZone(Float:position[3]) { new Float:mins[3] = { -32.0, -32.0, -32.0 } new Float:maxs[3] = { 32.0, 32.0, 32.0 } return CreateZone(position, mins, maxs, 0, 10); // ZM_NONE } public CreateZoneOnPlayer(player) { // Position und erzeugen new Float:position[3] pev(player, pev_origin, position) new entity = CreateNewZone(position) FindAllZones() for(new i = 0; i < maxzones; i++) if (zone[i] == entity) index = i; } // ----------------------------------------------------------------------------------------- // // Load & Save der WGZ // // ----------------------------------------------------------------------------------------- public SaveWGZ(player) { new zonefile[200] new mapname[50] // Verzeichnis holen get_configsdir(zonefile, 199) format(zonefile, 199, "%s/walkguard", zonefile) if (!dir_exists(zonefile)) mkdir(zonefile) // Namen über Map erstellen get_mapname(mapname, 49) format(zonefile, 199, "%s/%s.wgz", zonefile, mapname) delete_file(zonefile) // pauschal FindAllZones() // zur Sicherheit // Header write_file(zonefile, "; V1 - WalkGuard Zone-File") write_file(zonefile, "; [] ") write_file(zonefile, ";") write_file(zonefile, ";") write_file(zonefile, "; parameter") write_file(zonefile, ";") write_file(zonefile, "; - wgz_camper

metita commented 4 years ago

This is not the place to ask this, stop. @kisak-valve

MatiasGFaria commented 4 years ago

sorry I'm new I don't know where to post.

metita commented 4 years ago

Any AMXMOD X forum out there will help you, this is a place to contribute to the game itself.

MatiasGFaria commented 4 years ago

sorry I didn't know I left <3 Like not in any help you and I have looked for a solution a day ago for this problem and nobody has any idea. : V

kisak-valve commented 4 years ago

Hello @MatiasEsf, you've been given a 1 week timeout for your choice of abusive language per "Do not insult, harass, or demean anyone." at https://github.com/ValveSoftware/halflife#conduct.