new g_pBeam[33] new gAlreadyBought[33]; new iTeamLimit; public plugin_precache() { precache_model(modelname) precache_model("models/rpgrocket.mdl") // For the camera precache_sound("shmod/savage_engine.wav") precache_sound("debris/bustglass1.wav") boom = precache_model("sprites/zerogxplode.spr") }
if (pev(victim_id, pev_iuser1) == attacker_id || !zp_core_is_zombie(attacker_id)) return HAM_SUPERCEDE
return HAM_IGNORED }
public Ham_SavageTakeDamage_Post( victim_id, inflictor_id, attacker_id, Float:fDamage, iDamageBits) { static szNameCheck[32] pev(victim_id, pev_classname, szNameCheck, charsmax(szNameCheck)) if (!equal("savage", szNameCheck)) return HAM_IGNORED
if (pev(victim_id, pev_health) <= 0.0) { new ownerid = pev(victim_id, pev_owner) DamageNearby(ownerid) ColorChat(ownerid,GREEN, "[DS]^03 Your savage car got destroyed") return HAM_IGNORED }
return HAM_IGNORED } public plugin_natives() { register_native("free_racecar","give_rc", 1) } public give_rc(id) { g_iHasSavage[id] += 1 OpenSavageMenu(id) } public zp_fw_items_select_pre(id, itemid, ignorecost) { if (itemid != g_iItem) return ZP_ITEM_AVAILABLE
public zp_fw_gamemodes_end() { new iEntity = FM_NULLENT iTeamLimit = 0 while ((iEntity = engfunc(EngFunc_FindEntityByString, iEntity, "classname", "savage")) != 0) engfunc(EngFunc_RemoveEntity, iEntity) for (new id = 1; id <= get_maxplayers(); id++) { if (!is_user_connected(id)) continue
new Text[34] new Float:distance_diff, victim = -1 while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, get_pcvar_float(g_pCvarSavageRadius))) != 0) { if (!is_user_connected(victim)) continue
if (!is_user_alive(victim) || !zp_core_is_zombie(victim) || zp_item_zombie_madness_get(victim)) continue
RemoveSavages(id) { if (!is_user_connected(id)) return
DestroySavage(id) }
public savage_think(SavEnt) { new SavID = pev(SavEnt, pev_owner)
if (!is_user_alive(SavID) || zp_core_is_zombie(SavID)) { RemoveSavages(SavID) return }
new Float:FrameTime = (halflife_time() - fSavages[SavID][eLastTime]) fSavages[SavID][eLastTime] = halflife_time()
new Float:vOrigin[3] pev(SavEnt, pev_origin, vOrigin)
// Health handling if (pev(SavEnt, pev_health) < 0.0) { DestroySavage(SavID, true) client_print(SavID, print_center, "Your Car got destroyed") //zp_grenade_frost_set(SavID, false) return }
new Float:vVelocity[3] pev(SavEnt, pev_velocity, vVelocity)
// That stupid collision box gets stuck behind every little bump , so force it to keep moving vVelocity[0] = fSavages[SavID][eVelocity_x] * 0.8 + vVelocity[0] * 0.2 vVelocity[1] = fSavages[SavID][eVelocity_y] * 0.8 + vVelocity[1] * 0.2
// Input handling new buttonpress = 0 if (g_iSavageCamEntity[SavID] && g_iSavageEntity[SavID]) buttonpress = pev(SavID, pev_button)
new Float:EngineForce = fSavages[SavID][eEngineForce] new Float:TurnAngle = fSavages[SavID][eTurnAngle] new Float:BrakeForce = 0.0 new Float:JumpForce = fSavages[SavID][eJumpForce]
vVelocity[0] *= -0.5 vVelocity[1] *= -0.5 vVelocity[2] *= -0.5 set_pev(SavEnt, pev_velocity, vVelocity) } else { if (floatcos(vAngles[0], degrees) < -0.1) // Upside down in the ground, so crashed { TakeSavageBack(SavID) client_print(SavID, print_center, "Your car was almost crashed, write /rc to spawn it again") return }
// Just landed, check stunts if (JumpForce < 0.0) JumpForce = 0.0
if (Speed > 0.1) Grip = floatsin(Angle - VelocityAngle)
new Float:TireGrip = Grip if (TireGrip < MaxGrip*-1.0) TireGrip = MaxGrip*-1.0 else if (TireGrip > MaxGrip) TireGrip = MaxGrip
// Rotational force doesn't excists, but i got it right here :) vAVelocity[0] = 0.0 vAVelocity[1] = Speed * floatsin(TurnAngle) * (1-floatabs(Grip)) * dSavages[SavID][eDirection] vAVelocity[2] = 0.0
if (!(buttonpress & IN_ATTACK2) && JumpForce > 0.0) { vVelocity[2] += JumpForce * 100 JumpForce = 0.0 entity_set_byte(SavEnt, EV_BYTE_controller1, 127) entity_set_byte(SavEnt, EV_BYTE_controller2, 127) } else vVelocity[2] -= Gravity * FrameTime // To stop him from riding up the wall, almost
// Get class name of the entity that has been hit static szClassName[32] pev(iEntity, pev_classname, szClassName, charsmax(szClassName))
// Check if it is hitting a denied class name for (new iLoop = 0; iLoop < sizeof(szClassNameHitDenied); iLoop ++) { if (equali(szClassName, szClassNameHitDenied[iLoop])) return false }