[ Help ] Sync Animation
#1

hi guys, i look for sync animations every time you enter a server or you go indoors because i see the other player, i know you should use the callback called OnPlayerStreamIn (playerid) but i do not know how to use it, thx very much in advance.
Reply
#2

What do you want to do exactly? OnPlayerStreamIn is only called when a player streams on another player's screen (range, client-side)
Reply
#3

Quote:
Originally Posted by JaKe Elite
Посмотреть сообщение
What do you want to do exactly? OnPlayerStreamIn is only called when a player streams on another player's screen (range, client-side)
Hi guy, I'm looking for if a player makes an animation and I leave the server and go back in, I see that player with that animation
Reply
#4

You can sync the animation by setting the forcesync on ApplyAnimation to true (1), Animations made by the game itself like the door closing and etc can't be forced as far as I know
Reply
#5

hello guys again, I try to synchronize the animations, when I enter in an interior and go back at street the animation that is being made is not seen again, why is this happening?

the same thing happens to me when someone makes an animation and someone new join to the server does not see the animation that is being made, can you help me?? + rep

Reply
#6

Please show us the code, how you set the animation.
Reply
#7

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Please show us the code, how you set the animation.
It is a FS.

PHP код:
#include <zcmd>
#pragma tabsize 0
#define SPECIAL_ACTION_PISSING 68
forward Anims_OnPlayerKeyStateChange(playeridnewkeys);
forward Anims_OnPlayerDeath(playerid);
forward Anims_OnPlayerSpawn(playerid);
forward Anims_OnPlayerConnect(playerid);
forward Float:GetDistanceBetweenPlayers(p1,p2);
new 
animation[MAX_PLAYERS];
new 
saludoid;
new 
gPlayerUsingLoopingAnim[MAX_PLAYERS];
enum pInfo {
pAdmin
};
new 
PlayerInfo[MAX_PLAYERS][pInfo];
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));
}
//-------------------------------------------------
stock OnePlayAnim(playerid,animlib[],animname[], Float:Speedloopinglockxlockylockzlp)
{
    
ApplyAnimation(playeridanimlibanimnameSpeedloopinglockxlockylockzlp1);
    
gPlayerUsingLoopingAnim[playerid] = 0;
    
animation[playerid]++;
}
//-------------------------------------------------
stock LoopingAnim(playerid,animlib[],animname[], Float:Speedloopinglockxlockylockzlp)
{
    
gPlayerUsingLoopingAnim[playerid] = 1;
    
ApplyAnimation(playeridanimlibanimnameSpeedloopinglockxlockylockzlp1);
    
animation[playerid]++;
}
//-------------------------------------------------
stock StopLoopingAnim(playerid)
{
    
gPlayerUsingLoopingAnim[playerid] = 0;
    
ApplyAnimation(playerid"CARRY""crry_prtial"4.0000001);
}
//-------------------------------------------------
stock PreloadAnimLib(playeridanimlib[])
{
    
ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,00);
}
//-------------------------------------------------
// ********** CALLBACKS **********
public Anims_OnPlayerKeyStateChange(playeridnewkeys)
{
    if(!
gPlayerUsingLoopingAnim[playerid]) return 0;
    if(
newkeys KEY_HANDBRAKE)
    {
        
StopLoopingAnim(playerid);
        
animation[playerid] = 0;
        
gPlayerUsingLoopingAnim[playerid] = 0;
        return 
1;
    }
    return 
0;
}
//------------------------------------------------
public Anims_OnPlayerDeath(playerid)
{
    
gPlayerUsingLoopingAnim[playerid] = 0;
     return 
1;
}
//-------------------------------------------------
public Anims_OnPlayerSpawn(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,"CASINO");
        
PreloadAnimLib(playerid,"VENDING");
        
PreloadAnimLib(playerid,"MEDIC");
    return 
1;
}
//-------------------------------------------------
public Anims_OnPlayerConnect(playerid)
{
    
gPlayerUsingLoopingAnim[playerid] = 0;
    return 
1;
}
/************************************************************************************************************************************************************/
/************************************************************************ [COMMANDS] ************************************************************************/
/************************************************************************************************************************************************************/
CMD:carry(playeridparams[])
{
    
LoopingAnim(playerid,"CARRY","crry_prtial",4.1,0,1,1,1,1);
    return 
1;
}
... 
Reply
#8

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;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)