I am already preloading the animations here is my code
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
GetPlayerPos(playerid, PlayerVar[playerid][LastPos][0], PlayerVar[playerid][LastPos][1], PlayerVar[playerid][LastPos][2]);
FirstSpawn[playerid] = 0;
MyDReason[playerid] = reason;
MyKiller[playerid] = killerid;
return 1;
}
Код:
public OnPlayerSpawn(playerid)
{
if(!AnimLibPreloaded[playerid])
{
PreloadAnimLib(playerid,"BOMBER");
PreloadAnimLib(playerid,"RAPPING");
PreloadAnimLib(playerid,"SHOP");
PreloadAnimLib(playerid,"BEACH");
PreloadAnimLib(playerid,"SMOKING");
PreloadAnimLib(playerid,"FOOD");
PreloadAnimLib(playerid,"ON_LOOKERS");
PreloadAnimLib(playerid,"DEALER");
PreloadAnimLib(playerid,"CRACK");
PreloadAnimLib(playerid,"CARRY");
PreloadAnimLib(playerid,"COP_AMBIENT");
PreloadAnimLib(playerid,"PARK");
PreloadAnimLib(playerid,"INT_HOUSE");
PreloadAnimLib(playerid,"FOOD");
PreloadAnimLib(playerid,"PED");
AnimLibPreloaded[playerid] = 1;
}
TextDrawShowForPlayer(playerid, FuseGaming);
SetPlayerScore(playerid, PlayerVar[playerid][Level]);
SetPlayerToTeamColor(playerid);
SetPlayerSkin(playerid, PlayerVar[playerid][Skin]);
TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date);
if(FirstSpawn[playerid] == 1)
{
WorldTime(playerid);
}
SetPlayerSpawn(playerid);
return 1;
}
Код:
forward SetPlayerSpawn(playerid);
public SetPlayerSpawn(playerid)
{
if(SpawnOnSight[playerid] == 1 && FirstSpawn[playerid] == 0)
{
GameTextForPlayer(playerid, "~r~Injured", 5000, 3);
ClearAnimations(playerid);
TogglePlayerControllable(playerid,0);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid,0);
SetPlayerPos(playerid, PlayerVar[playerid][LastPos][0], PlayerVar[playerid][LastPos][1], PlayerVar[playerid][LastPos][2]);
ApplyAnimation(playerid,"CRACK","crckdeth3", 4.0, 0, 0, 0, 1, 0);
SpawnOnSight[playerid] = 0;
SpawnInHospital[playerid] = 1;
D_Timer[playerid] = SetTimerEx("DeathTimer",60000,true,"u",playerid);
}
else if(SpawnInHospital[playerid] == 1 && SpawnOnSight[playerid] == 0)
{
SendDeathMessage(MyKiller[playerid], playerid, MyDReason[playerid]);
TogglePlayerControllable(playerid,1);
SetCameraBehindPlayer(playerid);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
SetPlayerHealth(playerid, 55);
SetPlayerArmour(playerid, 0);
SetPlayerPos(playerid, 1177.3965, -1323.7709, 14.0686);
SendClientMessageEx(playerid, COL_GREY, "NOTICE: You have been injured and immediately sent to the hospital for treatment");
SendClientMessageEx(playerid, COL_GREY, "(( OOC NOTICE: You have lost 30 minutes of your memory, to prevent Revenge Killing ))");
SpawnOnSight[playerid] = 1;
SpawnInHospital[playerid] = 0;
KillTimer(D_Timer[playerid]);
ResetPlayerWeaponsEx(playerid);
}
return 1;
}
This is weird because my script looks clean and simple.Oh btw for the ones who didn't watch the video,The bottle is not in my hand it's just on the ground and only the player who died can see it.