Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ZombieAttack(zombieid)
- {
- if(GetRNPCHealth(dZombie[zombieid][dZombieID]) > 0)
- {
- new victim = GetZombieVictim(zombieid), Float:x, Float:y, Float:z;
- GetPlayerPos(dZombie[zombieid][dZombieID], x, y, z);
- if(victim != INVALID_PLAYER_ID)
- {
- if(IsPlayerInRangeOfPoint(victim, 1.0, x, y, z))
- {
- RNPC_StopPlayback(dZombie[zombieid][dZombieID]);//RNPC_PauseRecordingPlayback(dZombie[zombieid][dZombieID]);
- RNPC_CreateBuild(dZombie[zombieid][dZombieID], PLAYER_RECORDING_TYPE_ONFOOT);
- RNPC_AddPause(100);
- RNPC_SetKeys(KEY_FIRE);
- RNPC_AddPause(100);
- RNPC_SetKeys(0);
- RNPC_FinishBuild();
- RNPC_StartBuildPlayback(dZombie[zombieid][dZombieID]);
- //---
- GivePlayerHealth(victim, -ZOMBIE_DAMAGE, 0, dZombie[zombieid][dZombieID]);
- }
- else
- {
- RNPC_StopPlayback(dZombie[zombieid][dZombieID]);//RNPC_PauseRecordingPlayback(dZombie[zombieid][dZombieID]);
- new Float:x2, Float:y2, Float:z2, Float:angle = GetZAngleBetweenPos(x, y, x2, y2);
- GetPlayerPos(victim, x2, y2, z2);
- x2 = x + ((dZombie[zombieid][dZombieClass] == SPEED) ? 2.5 : 1.3) * floatsin(-angle, degrees);
- y2 = y + ((dZombie[zombieid][dZombieClass] == SPEED) ? 2.5 : 1.3) * floatcos(-angle, degrees);
- CA_FindZ_For2DCoord(x2, y2, z2);
- printf("x = %f - y = %f - z = %f - x2 = %f - y2 = %f - z2 = %f --- angle = %f", x, y, z, x2, y2, z2, angle);
- MoveRNPC(dZombie[zombieid][dZombieID], x2, y2, z2, (dZombie[zombieid][dZombieClass] == SPEED) ? RNPC_SPEED_SPRINT : RNPC_SPEED_RUN, 1);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement