SA-MP Forums Archive
Flying with animation - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Flying with animation (/showthread.php?tid=489919)



Flying with animation - Obcido - 24.01.2014

So, my /fly command works but I want a parachute animation for it. Here's the code:
Код:
	if(strcmp(cmdtext, "/fly", true) == 0)
	{
	    new Float:x, Float:y, Float:z;
	    if(PlayerInfo[playerid][pAdmin] >= 1)
		{
			if((flying[playerid] = !flying[playerid]))
			{
		    	GetPlayerPos(playerid, x, y, z);
		    	SetPlayerPosEx(playerid, x, y, z+5);
      			SetPlayerArmour(playerid, 32767);
		    	SetPlayerHealth(playerid, 32767);
		    	SetTimerEx("AdminFly", 1, 0, "d", playerid);
			}
			else
			{
		    	GetPlayerPos(playerid, x, y, z);
		    	SetPlayerPosEx(playerid, x, y, z+0.5);
		    	ClearAnimations(playerid);
		    	SetPlayerArmour(playerid, 0.0);
		   	 	SetPlayerHealth(playerid, 100.0);
				return 1;
			}
		}
		else
		{
		    SendClientMessage(playerid, GREY, "    You are not authorized to use that command.");
		}
		return 1;
	}
I'd really appreciate if you could tell me or give me a ready code for it!


Re: Flying with animation - Blademaster680 - 24.01.2014

Код:
if(strcmp(cmdtext, "/fly", true) == 0)
	{
	    new Float:x, Float:y, Float:z;
	    if(PlayerInfo[playerid][pAdmin] >= 1)
		{
			if((flying[playerid] = !flying[playerid]))
			{
		    	GetPlayerPos(playerid, x, y, z);
		    	SetPlayerPosEx(playerid, x, y, z+5);
      			SetPlayerArmour(playerid, 32767);
		    	SetPlayerHealth(playerid, 32767);
                        ApplyAnimation(playerid, "FLY", "FALL_skyDive", 4.1, 1, 1, 1, 1, 1, 1);
		    	SetTimerEx("AdminFly", 1, 0, "d", playerid);
			}
			else
			{
		    	GetPlayerPos(playerid, x, y, z);
		    	SetPlayerPosEx(playerid, x, y, z+0.5);
		    	ClearAnimations(playerid);
		    	SetPlayerArmour(playerid, 0.0);
		   	 	SetPlayerHealth(playerid, 100.0);
				return 1;
			}
		}
		else
		{
		    SendClientMessage(playerid, GREY, "    You are not authorized to use that command.");
		}
		return 1;
	}



Re: Flying with animation - Obcido - 24.01.2014

Quote:
Originally Posted by Blademaster680
Посмотреть сообщение
Код:
if(strcmp(cmdtext, "/fly", true) == 0)
	{
	    new Float:x, Float:y, Float:z;
	    if(PlayerInfo[playerid][pAdmin] >= 1)
		{
			if((flying[playerid] = !flying[playerid]))
			{
		    	GetPlayerPos(playerid, x, y, z);
		    	SetPlayerPosEx(playerid, x, y, z+5);
      			SetPlayerArmour(playerid, 32767);
		    	SetPlayerHealth(playerid, 32767);
                        ApplyAnimation(playerid, "FLY", "FALL_skyDive", 4.1, 1, 1, 1, 1, 1, 1);
		    	SetTimerEx("AdminFly", 1, 0, "d", playerid);
			}
			else
			{
		    	GetPlayerPos(playerid, x, y, z);
		    	SetPlayerPosEx(playerid, x, y, z+0.5);
		    	ClearAnimations(playerid);
		    	SetPlayerArmour(playerid, 0.0);
		   	 	SetPlayerHealth(playerid, 100.0);
				return 1;
			}
		}
		else
		{
		    SendClientMessage(playerid, GREY, "    You are not authorized to use that command.");
		}
		return 1;
	}
Now I crash when i do that command
Nevermind, fixed it.