[FilterScript] Admin22 Horse
#1

Animated Running Horse


Код:
#include <a_samp>

#define MAX_PLAY 30 // Slots on your server

#define interval 100

new Text:ANIMHORSE[MAX_PLAY];
new curHorseStage[MAX_PLAY] = {1, ...};
new HORSE_TIMER[MAX_PLAY];

#define dcmd(%1,%2,%3) if((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(horse, 5, cmdtext);
	return 0;
}

public OnFilterScriptExit()
{
	for(new playerid=0; playerid<MAX_PLAY; playerid++)
	{
	    if(GetPVarInt(playerid, "ANIM_HORSE")) TextDrawDestroy(ANIMHORSE[playerid]);
	}
}

public OnPlayerDisconnect(playerid, reason)
{
	if(GetPVarInt(playerid, "ANIM_HORSE"))
	{
	    KillTimer(HORSE_TIMER[playerid]);
	    TextDrawDestroy(ANIMHORSE[playerid]);
	}
	return 1;
}

dcmd_horse(playerid, params[])
{
	#pragma unused params
	if(GetPVarInt(playerid, "ANIM_HORSE"))
	{
		SetPVarInt(playerid, "ANIM_HORSE", 0);
    	KillTimer(HORSE_TIMER[playerid]);
    	TextDrawDestroy(ANIMHORSE[playerid]);
    	return 1;
	}

	SetPVarInt(playerid, "ANIM_HORSE", 1);

	ANIMHORSE[playerid] = TextDrawCreate(448.000000, 327.000000, "LD_OTB:hrs1");
	TextDrawAlignment(ANIMHORSE[playerid], 2);
	TextDrawBackgroundColor(ANIMHORSE[playerid], 255);
	TextDrawFont(ANIMHORSE[playerid], 4);
	TextDrawLetterSize(ANIMHORSE[playerid], 0.500000, 1.000000);
	TextDrawColor(ANIMHORSE[playerid], -1);
	TextDrawSetOutline(ANIMHORSE[playerid], 0);
	TextDrawSetProportional(ANIMHORSE[playerid], 1);
	TextDrawSetShadow(ANIMHORSE[playerid], 1);
	TextDrawUseBox(ANIMHORSE[playerid], 1);
	TextDrawBoxColor(ANIMHORSE[playerid], 255);
	TextDrawTextSize(ANIMHORSE[playerid], 200.000000, 200.000000);

	TextDrawShowForPlayer(playerid, ANIMHORSE[playerid]);

	curHorseStage[playerid] = 2;

	HORSE_TIMER[playerid] = SetTimerEx("do_horse_anim", interval, 1, "i", playerid);

	SendClientMessage(playerid, 0xFFFFFFFF, "Type {FFFF82}/horse{FFFFFF} again to turn off horse.");
	return 1;
}

forward do_horse_anim(playerid);
public do_horse_anim(playerid)
{
	if(!IsPlayerConnected(playerid) || !GetPVarInt(playerid, "ANIM_HORSE"))
	{
	    KillTimer(HORSE_TIMER[playerid]);
	    TextDrawDestroy(ANIMHORSE[playerid]);
	    return 1;
	}

	curHorseStage[playerid]++;
	if(curHorseStage[playerid] == 9) curHorseStage[playerid] = 1;
	new string[12];
	format(string, sizeof(string), "LD_OTB:hrs%i", curHorseStage[playerid]);
	TextDrawSetString(ANIMHORSE[playerid], string);

	TextDrawHideForPlayer(playerid, ANIMHORSE[playerid]);
	TextDrawShowForPlayer(playerid, ANIMHORSE[playerid]);
	return 1;
}
Picture :-
Reply
#2

Good.
Reply
#3

Quote:
Originally Posted by Tafara...(.)
Посмотреть сообщение
Good.
Thanks..!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)