Apply Animation, Not working?
#1

pawn Код:
CMD:cuff(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    new giveplayerid, string[128];
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /cuff [player id or name]");
    if(Faction[playerid] != 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not a member of the police.");
    if(!IsPlayerNearPlayer(playerid, giveplayerid, 3.0))return SendClientMessage(playerid, COLOUR_GREY, "You must be close to the player to cuff them.");
    {
        ApplyAnimation(giveplayerid, "PED", "cower", 1, 1, 0, 0, 0, 0, 1);
        TogglePlayerControllable(giveplayerid, 0);
        format(string, sizeof(string), "Officer %s has placed handcuffs on %s", GetNameEx(playerid), GetNameEx(giveplayerid));
        ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
    }
    return 1;
}
Alright, I go in game and cuff myself, it doesnt apply the animation for some reason. I cannot understand why.

Any help would be appreciated, + rep.
Reply
#2

Try cuffing someone else ?
Reply
#3

PHP код:
CMD:cuff(playeridparams[])
{
    if(
LoggedIn[playerid] == 0) return SendClientMessage(playeridCOLOUR_GREY"You must be logged in to use this command.");
    new 
giveplayeridstring[128];
    if(
sscanf(params"u"giveplayerid)) return SendClientMessage(playeridCOLOUR_GREY"Usage: /cuff [player id or name]");
    if(
Faction[playerid] != 1) return SendClientMessage(playeridCOLOUR_GREY"You are not a member of the police.");
    if(!
IsPlayerNearPlayer(playeridgiveplayerid3.0))return SendClientMessage(playeridCOLOUR_GREY"You must be close to the player to cuff them.");
    {
        
TogglePlayerControllable(giveplayerid0);
        
ClearAnimations(giveplayerid);
        
ApplyAnimation(giveplayerid"PED""cower"1100001);
        
format(stringsizeof(string), "Officer %s has placed handcuffs on %s"GetNameEx(playerid), GetNameEx(giveplayerid));
        
ProxDetector(30.0playeridstringCOLOUR_PURPLECOLOUR_PURPLECOLOUR_PURPLECOLOUR_PURPLECOLOUR_PURPLE);
    }
    return 
1;

Reply
#4

Removed.
Reply
#5

Quote:
Originally Posted by Davz*|*Criss
Посмотреть сообщение
Under IsPlayerNearPlayer remove the brace { and at the end up of return 1; remove the brace }

Just do that four functions without declaring it in IsPlayerNearPlayer.
Probably: =WoR=G4M3Ov3r is right. Since I had the same problem while I didn't have those { and }
Reply
#6

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
Probably: =WoR=G4M3Ov3r is right. Since I had the same problem while I didn't have those { and }
The braces aren't needed.
Reply
#7

The point is that the braces SHOULD NOT be there. It's not a matter of taste and so but they should just not be there.
Reply
#8

Try like this ...

Код:
CMD:cuff(playerid, params[])
{
	if(LoggedIn[playerid] == 0) 
		return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    
	new giveplayerid, string[128];
	if(sscanf(params, "u", giveplayerid)) 
		return SendClientMessage(playerid, COLOUR_GREY, "Usage: /cuff [player id or name]");
    
	if(Faction[playerid] != 1) 
		return SendClientMessage(playerid, COLOUR_GREY, "You are not a member of the police.");
    
	if(!IsPlayerNearPlayer(playerid, giveplayerid, 3.0))
		return SendClientMessage(playerid, COLOUR_GREY, "You must be close to the player to cuff them.");

	ApplyAnimation(giveplayerid, "PED", "cower", 1, 1, 0, 0, 0, 0, 1);
	TogglePlayerControllable(giveplayerid, 0);
	format(string, sizeof(string), "Officer %s has placed handcuffs on %s", GetNameEx(playerid), GetNameEx(giveplayerid));
	ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
	return 1;
}
Код:
if(!IsPlayerNearPlayer(playerid, giveplayerid, 3.0))
checks if the player is not near the specified player, if not, will end the command, else, will continue the command.
Reply
#9

You need to preload all the animation libraries you use first.
pawn Код:
stock PreloadAnimLib(playerid, animlib[])
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
Then put this under OnPlayerSpawn or so:
pawn Код:
PreloadAnimLib(playerid, "PED");
Reply
#10

You need to play this anim,when you try this first time anim dont play and when you try second time anim play

put same anim onplayerspawn
Reply
#11

Thanks!
Reply
#12

All of them:
pawn Code:
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" );
Missed anything?
Reply
#13

Quote:
Originally Posted by =WoR=Varth
View Post
All of them:
pawn Code:
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" );
Missed anything?
And of course not forgetting:

pawn Code:
PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
Reply
#14

Quote:
Originally Posted by Stigg
View Post
And of course not forgetting:

pawn Code:
PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
Vince already mention that.
Reply
#15

Quote:
Originally Posted by =WoR=Varth
View Post
Vince already mention that.
It was just a reminder.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)