What do you want to do exactly? OnPlayerStreamIn is only called when a player streams on another player's screen (range, client-side)
|
#include <zcmd>
#pragma tabsize 0
#define SPECIAL_ACTION_PISSING 68
forward Anims_OnPlayerKeyStateChange(playerid, newkeys);
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:Speed, looping, lockx, locky, lockz, lp)
{
ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp, 1);
gPlayerUsingLoopingAnim[playerid] = 0;
animation[playerid]++;
}
//-------------------------------------------------
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, 1);
animation[playerid]++;
}
//-------------------------------------------------
stock StopLoopingAnim(playerid)
{
gPlayerUsingLoopingAnim[playerid] = 0;
ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0, 1);
}
//-------------------------------------------------
stock PreloadAnimLib(playerid, animlib[])
{
ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0, 0);
}
//-------------------------------------------------
// ********** CALLBACKS **********
public Anims_OnPlayerKeyStateChange(playerid, newkeys)
{
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(playerid, params[])
{
LoopingAnim(playerid,"CARRY","crry_prtial",4.1,0,1,1,1,1);
return 1;
}
...
/*************************************************************************/
/************************* [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;