Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:pucajme(playerid, params[]) {
- FCNPC_GiveAmmo(TestNPCID, 100);
- FCNPC_AimAtPlayer(TestNPCID, playerid, false);
- NPC_PucajNa(TestNPCID, playerid);
- return true;
- }
- //
- forward NPC_PucajNa(npcid, target);
- public NPC_PucajNa(npcid, target)
- {
- if(FCNPC_IsValid(npcid)) {
- new Float:x, Float:y, Float:z, Float: tempdist;
- FCNPC_GetPosition(npcid, x,y,z);
- new Float:PPX, PPY, PPZ;
- GetPlayerPos(target, PPX, PPY, PPZ);
- tempdist = GetPlayerDistanceFromPoint(target, x, y, z);
- if(tempdist < 20) {
- new time, chance;
- switch(FCNPC_GetWeapon(npcid)) {
- case 25, 26, 27: time = 400, chance = 35;
- case 33, 34: time = 500, chance = 50;
- case 24: time = 700, chance = 40;
- default: time = 200, chance = 40;
- }
- FCNPC_AimAtPlayer(npcid, target, false);
- SetTimerEx("NPC_PucajNa", time, false, "ii", playerid, target);
- if(random(100) < chance) {
- DamagePlayer(target, 5.0, INVALID_PLAYER_ID, FCNPC_GetWeapon(npcid));
- FCNPC_TriggerWeaponShot(npcid, FCNPC_GetWeapon(npcid), BULLET_HIT_TYPE_PLAYER, target, PPX,PPY,PPZ);
- }
- else {
- FCNPC_TriggerWeaponShot(npcid, FCNPC_GetWeapon(npcid), BULLET_HIT_TYPE_PLAYER, target, PPX+0.5,PPY+0.5,PPZ);
- }
- }
- else FCNPC_StopAim(npcid);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement