This code is for players when they die, enter the servers or change their site and return where the player was doing the ANIMATION can see it synchronized.
pawn Код:
/*************************************************************************/
/************************* [INCLUDES]*************************************/
/************************************************************************/
#include <a_samp>
#include <zcmd>
/**************************************************************************/
/************************* [DEFINE]****************************************/
/************************************************************************/
#define SPECIAL_ACTION_PISSING 68
#define orange 0xFF9100AA
#define white 0xFFFFFFAA
#define yellow 0xFAEC8EAA
#define red 0xFF0000AA
#define cyan 0x90C3D4AA
/**************************************************************************/
/******************************[NEWS] ************************************/
/************************************************************************/
new gPlayerAnimLibsPreloaded[MAX_PLAYERS];
new animation[MAX_PLAYERS];
new saludoid;
new gPlayerUsingLoopingAnim[MAX_PLAYERS];
new PlayerTied[MAX_PLAYERS];
new PlayerCuffed[MAX_PLAYERS];
new PlayerFrozen[MAX_PLAYERS];
enum pInfo {
pAdmin
};
new PlayerInfo[MAX_PLAYERS][pInfo];
forward Float:GetDistanceBetweenPlayers(p1,p2);
public Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
/*************************************************************************/
/************************* [STOCKS]***************************************/
/************************************************************************/
stock LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
gPlayerUsingLoopingAnim[playerid] = 1;
ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
}
//-------------------------------------------------
stock StopLoopingAnim(playerid)
{
gPlayerUsingLoopingAnim[playerid] = 0;
ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
}
//-------------------------------------------------
stock OnePlayAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
}
//-------------------------------------------------
stock PreloadAnimLib(playerid, animlib[])
{
ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0,0);
}
/*************************************************************************/
/************************* [COMANDOS] ***********************************/
/***********************************************************************/
CMD:sit(playerid, params[])
{
LoopingAnim(playerid,"Attractors","Stepsit_in",4.0,0,0,0,1,0,1); // no looping (if dont see people this animation, add forcesync "1", but normaly dont add forcesync)
LoopingAnim(playerid,"FOOD","FF_Sit_Eat3",4.0,0,0,0,1,0); // no looping (this it has not forcesync)
return 1;
}
/*************************************************************************/
/************************* [CALL BACKS] ***********************************/
/***********************************************************************/
public OnPlayerSpawn(playerid)
{
if(!gPlayerAnimLibsPreloaded[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");
PreloadAnimLib(playerid,"GANGS");
gPlayerAnimLibsPreloaded[playerid] = 1;
}
return 1;
}
public OnPlayerConnect(playerid)
{
gPlayerAnimLibsPreloaded[playerid] = 0;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
gPlayerAnimLibsPreloaded[playerid] = 0;
return 1;