Ped
This commit is contained in:
389
ReallifeGamemode.Client/util/ped.ts
Normal file
389
ReallifeGamemode.Client/util/ped.ts
Normal file
@@ -0,0 +1,389 @@
|
||||
export default function ped() {
|
||||
var ped
|
||||
var AddPed
|
||||
mp.events.add("CLIENT:AddPed", (PedNr, model, positionx, positiony, positionz, heading, dimension, dynamic, freeze, collision, weapon, attackproof, fireexplosionproof, drownproof) => {
|
||||
PedNr = mp.peds.new(
|
||||
mp.game.joaat(`${model}`),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
PedNr.setDynamic(dynamic);
|
||||
PedNr.freezePosition(freeze);
|
||||
if (collision == 0) {
|
||||
PedNr.setCollision(true, true);
|
||||
PedNr.setProofs(attackproof, fireexplosionproof, fireexplosionproof, true, attackproof, false, false, drownproof)
|
||||
}
|
||||
if (collision == 1) {
|
||||
PedNr.setCollision(false, true);
|
||||
PedNr.setProofs(attackproof, fireexplosionproof, fireexplosionproof, false, attackproof, false, false, drownproof)
|
||||
}
|
||||
if (collision == 2) {
|
||||
PedNr.setCollision(true, false);
|
||||
PedNr.setProofs(attackproof, fireexplosionproof, fireexplosionproof, true, attackproof, false, false, drownproof)
|
||||
}
|
||||
if (collision == 3) {
|
||||
PedNr.setCollision(false, false);
|
||||
PedNr.setProofs(attackproof, fireexplosionproof, fireexplosionproof, false, attackproof, false, false, drownproof)
|
||||
}
|
||||
PedNr.setCanBeDamaged(attackproof);
|
||||
PedNr.setInvincible(attackproof);
|
||||
//mp.gui.chat.push(`SetInvincible(${attackproof};`);
|
||||
//mp.gui.chat.push(`SetProofs(${attackproof}, ${fireexplosionproof}, ${attackproof}, ${drownproof});`);
|
||||
|
||||
//let pedweapon = mp.game.weapon.createWeaponObject(mp.game.joaat(`${weapon}`), 9999, 0.0, 0.0, 0.0, false, 0.0, 0.0)
|
||||
//mp.game.weapon.giveWeaponObjectToPed(pedweapon, AddPed);
|
||||
mp.game.invoke("0xBF0FD6E56C964FCB", PedNr.handle, mp.game.joaat("weapon_SpecialCarbine"), 100, 0, 1);
|
||||
});
|
||||
mp.events.add("CLIENT:DestroyPed", (PedNr) => {
|
||||
PedNr.destroy();
|
||||
});
|
||||
mp.events.add("CLIENT:AddPedModel", (model, positionx, positiony, positionz, heading, dimension) => {
|
||||
if (model < 1) {
|
||||
return;
|
||||
}
|
||||
if (model == 1) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_chickenhawk'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 2) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_boar'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 3) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('cs_bradcadaver'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 4) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_cat_01'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 5) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_chimp'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 6) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_chop'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 7) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_cormorant'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 8) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_cow'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 9) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_coyote'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 10) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_crow'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 11) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_deer'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 12) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_dolphin'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 13) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_fish'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 14) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_sharkhammer'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 15) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_humpback'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 16) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_husky'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 17) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('ig_johnnyklebitz'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 18) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_killerwhale'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 19) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('mp_m_marston_01'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 20) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_mtlion'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 21) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('s_m_m_movalien_01'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 22) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('mp_m_niko_01'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 23) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_pig'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 24) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_pigeon'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 25) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_poodle'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 26) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_pug'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 27) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_rabbit_01'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 28) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_rat'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 29) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_retriever'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 30) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_rhesus'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 31) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_rottweiler'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 32) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_seagull'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 33) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_shepherd'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 34) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_stingray'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 35) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_sharktiger'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 36) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('a_c_westy'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 37) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('ig_barry'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 38) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('cs_barry'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
if (model == 39) {
|
||||
ped = mp.peds.new(
|
||||
mp.game.joaat('ig_bankman'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
/*let dynamicPed = mp.peds.new(mp.game.joaat('mp_m_freemode_01'), mp.players.at(0).position, { dynamic: true });
|
||||
dynamicPed.controller = mp.players.at(0);
|
||||
|
||||
let staticPed = mp.peds.new(mp.game.joaat('player_zero'), mp.players.at(0).position,
|
||||
{
|
||||
dynamic: false, // still server-side but not sync'ed anymore
|
||||
frozen: true,
|
||||
invincible: true
|
||||
});*/
|
||||
if (model == 40) {
|
||||
var ped44 = mp.peds.new(
|
||||
mp.game.joaat('cs_bankman'),
|
||||
new mp.Vector3(positionx, positiony, positionz),
|
||||
heading,
|
||||
dimension
|
||||
);
|
||||
}
|
||||
ped.freezePosition(false);
|
||||
ped.setInvincible(false);
|
||||
ped.setProofs(false, false, false, false, false, false, false, false);
|
||||
ped.setVisible(true, true);
|
||||
//ped.applyForceTo(5, positionx + 5, positiony + 5, positionz, 0.0, 0.0, 0.0, 1, true, true, true, true, true);
|
||||
ped.processAttachments();
|
||||
ped.setAlwaysPrerender(true);
|
||||
ped.setAsMission(true, true);
|
||||
ped.setCanBeTargetedWithoutLos(true);
|
||||
ped.setIsTargetPriority(true, true);
|
||||
ped.setMotionBlur(true);
|
||||
ped.setRenderScorched(true);
|
||||
//ped.setAlpha(100);
|
||||
mp.game.invoke("0xBF0FD6E56C964FCB", ped.handle, mp.game.joaat("weapon_SpecialCarbine"), 100, false, true);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user