Preloading animation libs only for ID 0
#1

Hello.

I have a problem with preloading the animation libs upon player connection.
It only preloads for ID 0.

Quote:
Originally Posted by Bible
Here's an example of how I noticed:
When a player connects, he will see the class selection screen and the first class performs an anim.
ID 0 for whom the animlibs are preloaded can see the animation. For ID 1 and above, it is not visible upon connection (only when they scroll one class further.)
Quote:
Originally Posted by Bible
Another example:
When a police officer tazes a player it shows the animation to ID 0 (First shot). The animation will become visible for everyone upon the second shot.
I have tried this method:

Ontop of my script:
pawn Код:
new AnimLibraies[129][14] =
{
    "AIRPORT","Attractors","BAR","BASEBALL","BD_FIRE","BEACH","benchpress","BF_injection","BIKED","BIKEH",
    "BIKELEAP","BIKES","BIKEV","BIKE_DBZ","BLOWJOBZ","BMX","BOMBER","BOX","BSKTBALL","BUDDY","BUS","CAMERA",
    "CAR","CARRY","CAR_CHAT","CASINO","CHAINSAW","CHOPPA","CLOTHES","COACH","COLT45","COP_AMBIENT","COP_DVBYZ",
    "CRACK","CRIB","DAM_JUMP","DANCING","DEALER","DILDO","DODGE","DOZER","DRIVEBYS","FAT","FIGHT_B","FIGHT_C",
    "FIGHT_D","FIGHT_E","FINALE","FINALE2","FLAME","Flowers","FOOD","Freeweights","GANGS","GHANDS","GHETTO_DB",
    "goggles","GRAFFITI","GRAVEYARD","GRENADE","GYMNASIUM","HAIRCUTS","HEIST9","INT_HOUSE","INT_OFFICE",
    "INT_SHOP","JST_BUISNESS","KART","KISSING","KNIFE","LAPDAN1","LAPDAN2","LAPDAN3","LOWRIDER","MD_CHASE",
    "MD_END","MEDIC","MISC","MTB","MUSCULAR","NEVADA","ON_LOOKERS","OTB","PARACHUTE","PARK","PAULNMAC","ped",
    "PLAYER_DVBYS","PLAYIDLES","POLICE","POOL","POOR","PYTHON","QUAD","QUAD_DBZ","RAPPING","RIFLE","RIOT",
    "ROB_BANK","ROCKET","RUSTLER","RYDER","SCRATCHING","SHAMAL","SHOP","SHOTGUN","SILENCED","SKATE","SMOKING",
    "SNIPER","SPRAYCAN","STRIP","SUNBATHE","SWAT","SWEET","SWIM","SWORD","TANK","TATTOOS","TEC","TRAIN","TRUCK",
    "UZI","VAN","VENDING","VORTEX","WAYFARER","WEAPONS","WUZI"
};
OnPlayerConnect:
pawn Код:
if(!gPlayerLoadedAnimLibs[playerid])
    {
        for(new i = 0; i < 129; i++)
        {
            ApplyAnimation(playerid, AnimLibraies[i], "null", 0.0, 0, 0, 0, 0, 0);
        }
        gPlayerLoadedAnimLibs[playerid] = true;
    }
And I have tried this method:

OnPlayerConnect:
pawn Код:
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");
pawn Код:
stock PreloadAnimLib(playerid, animlib[]) ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
Does anyone happen to know how to solve this?

Help is much appreciated!
Reply
#2

Код:
if(gPlayerLoadedAnimLibs[playerid] == false)
    {
        for(new i = 0; i < 129; i++)
        {
            ApplyAnimation(playerid, AnimLibraies[i], "null", 0.0, 0, 0, 0, 0, 0);
        }
        gPlayerLoadedAnimLibs[playerid] = true;
    }
Onplayerconnect()
gPlayerLoadedAnimLibs[playerid] = false;

If i helped you please Rep+ me
Reply
#3

Quote:
Originally Posted by VishvaJeet
Посмотреть сообщение
Код:
if(!gPlayerLoadedAnimLibs[playerid])
    {
        for(new i = 0; i < 129; i++)
        {
            ApplyAnimation(i, AnimLibraies[i], "null", 0.0, 0, 0, 0, 0, 0);
        }
        gPlayerLoadedAnimLibs[i] = true;
    }
If i helped you please Rep+ me
This has nothing to do with the problem.
Reply
#4

Didn't he just copy my first method? LOL!
Reply
#5

Код:
gPlayerLoadedAnimLibs[playerid] = false;
if(gPlayerLoadedAnimLibs[playerid] == false)
    {
        for(new i = 0; i < 129; i++)
        {
            ApplyAnimation(playerid, AnimLibraies[i], "null", 0.0, 0, 0, 0, 0, 0);
        }
        gPlayerLoadedAnimLibs[playerid] = true;
    }

If i helped you please Rep+ me
Reply
#6

Quote:
Originally Posted by VishvaJeet
Посмотреть сообщение
-
I appreciate your effort to help but you did the exact same thing as you did in the first reply.
You just replaced the exclamation point with "== false" and that's it. Basically that's the same.
Reply
#7

What you want can u explain ?
Reply
#8

Quote:
Originally Posted by VishvaJeet
Посмотреть сообщение
What you want can u explain ?
Isn't my topic clear enough?
The fact that you just replied a code that I used in my topic tells me that you didn't even read through it.
Read it.
Reply
#9

Are you resetting the variable?

Maybe this would help (Not sure), remove the if(!gPlayerLoadedAnimLibs[playerid]) and then just add this instead:
pawn Код:
for(new i = 0; i < 129; i++)
{
    ApplyAnimation(playerid, AnimLibraies[i], "null", 0.0, 0, 0, 0, 0, 0);
}
gPlayerLoadedAnimLibs[playerid] = true;
(Yes it is your code)

Players will never have them loaded when they connected, so no need to check, it might be bugging it.
Reply
#10

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Are you resetting the variable?

Maybe this would help (Not sure), remove the if(!gPlayerLoadedAnimLibs[playerid]) and then just add this instead:
pawn Код:
for(new i = 0; i < 129; i++)
{
    ApplyAnimation(playerid, AnimLibraies[i], "null", 0.0, 0, 0, 0, 0, 0);
}
gPlayerLoadedAnimLibs[playerid] = true;
(Yes it is your code)

Players will never have them loaded when they connected, so no need to check, it might be bugging it.
Yeah, I'm resetting a player's data upon connection before executing the rest.
I'll try it out and I will edit this post with the result. Thank you in advance.

Quote:
Originally Posted by MicroD
Посмотреть сообщение
From Kalcor's gl_actions
Код:
new gPlayerAnimLibsPreloaded[MAX_PLAYERS];

stock PreloadAnimLib(playerid, animlib[])
{
	ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}


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");
		gPlayerAnimLibsPreloaded[playerid] = 1;
	}
	return 1;
}

public OnPlayerConnect(playerid)
{
        gPlayerAnimLibsPreloaded[playerid] = 0;
	return 1;
}
Thanks for the reply.
I don't want to place the preload code under OnPlayerSpawn since the classes in the class selection also perform animations.

EDIT: Stinged, it didn't work. Same problem.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)