Senior Member
Join Date: Dec 2014
Location: Iraq
|
12-09-2015
, 15:33
[Tutorial] Eighth lesson in a series develop [ZPA 1.61] - Unstuck Feature.
|
#1
|
Eighth Lesson Add (Unstuck Feature)
- all rights reserved to arvEL.-, in : 9/12/2015 In these lesson i will explain how to develop [Zombie Plague Advance v1.6.1]
re programming unstuck feature.
first go to this topic [ # ] and download[ZPA 1.6.1]
after that open the file [zombie_plague_advance_v1-6-1.sma] in [notepad++]
first add this variables
PHP Code:
// Unstuck new on_stuck[33] new const Float:sizez[][3] = { {0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}, {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0}, {1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, -1.0, -1.0}, {0.0, 0.0, 2.0}, {0.0, 0.0, -2.0}, {0.0, 2.0, 0.0}, {0.0, -2.0, 0.0}, {2.0, 0.0, 0.0}, {-2.0, 0.0, 0.0}, {-2.0, 2.0, 2.0}, {2.0, 2.0, 2.0}, {2.0, -2.0, 2.0}, {2.0, 2.0, -2.0}, {-2.0, -2.0, 2.0}, {2.0, -2.0, -2.0}, {-2.0, 2.0, -2.0}, {-2.0, -2.0, -2.0}, {0.0, 0.0, 3.0}, {0.0, 0.0, -3.0}, {0.0, 3.0, 0.0}, {0.0, -3.0, 0.0}, {3.0, 0.0, 0.0}, {-3.0, 0.0, 0.0}, {-3.0, 3.0, 3.0}, {3.0, 3.0, 3.0}, {3.0, -3.0, 3.0}, {3.0, 3.0, -3.0}, {-3.0, -3.0, 3.0}, {3.0, -3.0, -3.0}, {-3.0, 3.0, -3.0}, {-3.0, -3.0, -3.0}, {0.0, 0.0, 4.0}, {0.0, 0.0, -4.0}, {0.0, 4.0, 0.0}, {0.0, -4.0, 0.0}, {4.0, 0.0, 0.0}, {-4.0, 0.0, 0.0}, {-4.0, 4.0, 4.0}, {4.0, 4.0, 4.0}, {4.0, -4.0, 4.0}, {4.0, 4.0, -4.0}, {-4.0, -4.0, 4.0}, {4.0, -4.0, -4.0}, {-4.0, 4.0, -4.0}, {-4.0, -4.0, -4.0}, {0.0, 0.0, 5.0}, {0.0, 0.0, -5.0}, {0.0, 5.0, 0.0}, {0.0, -5.0, 0.0}, {5.0, 0.0, 0.0}, {-5.0, 0.0, 0.0}, {-5.0, 5.0, 5.0}, {5.0, 5.0, 5.0}, {5.0, -5.0, 5.0}, {5.0, 5.0, -5.0}, {-5.0, -5.0, 5.0}, {5.0, -5.0, -5.0}, {-5.0, 5.0, -5.0}, {-5.0, -5.0, -5.0} }
now press [Ctrl + F] and find this line:
PHP Code:
case 3: // Unstuck
it's have this codes:
PHP Code:
case 3: // Unstuck { // Check if player is stuck if (g_isalive[id]) { if (is_player_stuck(id)) { // Move to an initial spawn if (get_pcvar_num(cvar_randspawn)) do_random_spawn(id) // random spawn (including CSDM) else do_random_spawn(id, 1) // regular spawn } else zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_STUCK") } else zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT") }
replace all codes to:
PHP Code:
case 3: // Unstuck { // Check if player is stuck if (g_isalive[id]) { if (is_player_stuck(id)) { client_print_color(id, Grey, "^x04[ZP]^x01 You have been unstucked!") static players[32], pnum , Float:origin[3], Float:mins[3], hull, Float:vec[3], o , i get_players(players, pnum) for(i=0; i<pnum; i++){ id = players[i] if (is_user_connected(id) && is_user_alive(id)) { pev(id, pev_origin, origin) hull = pev(id, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN if (!unstuck_is_hull_vacant(origin, hull,id) && !get_user_noclip(id) && !(pev(id,pev_solid) & SOLID_NOT)) { ++on_stuck[id] if(on_stuck[id] >= 1) { pev(id, pev_mins, mins) vec[2] = origin[2] for (o=0; o < sizeof sizez; ++o) { vec[0] = origin[0] - mins[0] * sizez[o][0] vec[1] = origin[1] - mins[1] * sizez[o][1] vec[2] = origin[2] - mins[2] * sizez[o][2] if (unstuck_is_hull_vacant(vec, hull,id)) { engfunc(EngFunc_SetOrigin, id, vec) message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id); write_short(1<<10); write_short(1<<10); write_short(1<<12); write_byte(220); write_byte(193); write_byte(9); write_byte(70); message_end(); client_cmd(id,"spk fvox/blip.wav") set_pev(id,pev_velocity,{0.0,0.0,0.0}) o = sizeof sizez } } } } else { on_stuck[id] = 0 } } } } else client_print_color(id, Grey, "^x04[ZP]^x01 You are not stuck...") } else client_print_color(id, Grey, "^x04[ZP]^x01 Unavailable command.") }
how add this codes in any place inside ZPA.sma main.
PHP Code:
// Stock unstuck stock bool:unstuck_is_hull_vacant(const Float:origin[3], hull,id) { static tr engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr) if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) //get_tr2(tr, TR_InOpen)) return true return false }
now make compile and ejnoy
all rights reserved to arvEL.-
__________________
Last edited by arvEL.; 12-09-2015 at 15:33.
|
|