Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//Function: HammerPlayer(playerid, Float:speed); || PenetratePlayer(playerid, Float:speed);
#if defined _rHammerPlayer_Included
#endinput
#endif
#define _rHammerPlayer_Included
#include <a_samp>
new ActualHammer[MAX_PLAYERS];
new ActualHammerTwo[MAX_PLAYERS];
new ActualTimer[MAX_PLAYERS];
new bool:HammerOn[MAX_PLAYERS];
#if defined Ham_OnPlayerDisconnect
forward Ham_OnPlayerDisconnect(playerid, reason);
#endif
stock PenetratePlayer(playerid, Float:speed = 3.5)
return HammerPlayer(playerid, speed);
stock HammerPlayer(playerid, Float:speed = 3.5)
{
if(HammerOn[playerid]) return 0;
HammerOn[playerid] = true;
TogglePlayerControllable(playerid, 0);
ActualTimer[playerid] = SetTimerEx("RemoveHammer", 500, true, "i", playerid);
PlayerPlaySound(playerid, 100015, 0, 0, 0);
new Float:HammerPosX, Float:HammerPosY, Float:HammerPosZ;
GetPlayerPos(playerid, HammerPosX, HammerPosY, HammerPosZ);
new Float:HammerPosR = 265.000;
SetPlayerFacingAngle(playerid, HammerPosR);
ActualHammer[playerid] = CreateObject(19631, HammerPosX-5, HammerPosY, HammerPosZ-0.6, 0.00000, 0.00000, HammerPosR+180.00000);
MoveObject(ActualHammer[playerid], HammerPosX-0.3, HammerPosY, HammerPosZ, speed);
ActualHammerTwo[playerid] = CreateObject(19631, HammerPosX, HammerPosY+1.0, HammerPosZ+3, 0.00000, 160.00000, HammerPosR+80.0000);
MoveObject(ActualHammerTwo[playerid], HammerPosX, HammerPosY, HammerPosZ-4, speed);
GameTextForPlayer(playerid, "~r~!!!Penetrated!!!", 500, 6);
SetPlayerCameraPos(playerid, HammerPosX+3, HammerPosY-3, HammerPosZ+2);
SetPlayerCameraLookAt(playerid, HammerPosX, HammerPosY, HammerPosZ-1);
return 1;
}
forward RemoveAnims(playerid);
public RemoveAnims(playerid) return ClearAnimations(playerid);
forward RemoveHammer(playerid);
public RemoveHammer(playerid)
{
if(!IsObjectMoving(ActualHammer[playerid]) && !IsObjectMoving(ActualHammerTwo[playerid]))
{
TogglePlayerControllable(playerid, 1);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
KillTimer(ActualTimer[playerid]);
DestroyObject(ActualHammer[playerid]);
DestroyObject(ActualHammerTwo[playerid]);
SetCameraBehindPlayer(playerid);
HammerOn[playerid] = false;
SetTimerEx("RemoveAnims", 1500, false, "i", playerid);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(HammerOn[playerid])
{
KillTimer(ActualTimer[playerid]);
DestroyObject(ActualHammer[playerid]);
DestroyObject(ActualHammerTwo[playerid]);
HammerOn[playerid] = false;
}
#if defined Ham_OnPlayerDisconnect
return Ham_OnPlayerDisconnect(playerid, reason);
#else
return 1;
#endif
}
#if defined _ALS_OnPlayerDisconnect
#undef OnPlayerDisconnect
#else
#define _ALS_OnPlayerDisconnect
#endif
#define OnPlayerDisconnect Ham_OnPlayerDisconnect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment