//Animations by Bombo
//Version: 1.0.1
//01.03.2014
#include<a_samp>
#define INVALID_TIMER_ID 0xFFFF
new gDebShow;
new gDebugPlayerID;
#pragma unused gDebShow
#pragma unused gDebugPlayerID
forward ShowAnim();
public ShowAnim()
{
static prev_anim;
new anim;
new str[64];
if(!IsPlayerConnected(gDebugPlayerID))
{
KillTimer(gDebShow);
return;
}
anim = GetPlayerAnimationIndex(gDebugPlayerID);
if(prev_anim != anim)
{
format(str, sizeof(str), "Animation code: %d", anim);
SendClientMessage(0, 0x55FFCAFF, str);
prev_anim = anim;
}
}
public OnFilterScriptInit()
{
gDebShow = INVALID_TIMER_ID;
// gDebShow = SetTimer("ShowAnim", 100, true);
}
public OnFilterScriptExit()
{
if(gDebShow != INVALID_TIMER_ID)
KillTimer(gDebShow);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/animations", true) == 0)
{
if(gDebShow == INVALID_TIMER_ID)
{
gDebugPlayerID = playerid;
gDebShow = SetTimer("ShowAnim", 100, true);
SendClientMessage(playerid, 0xFF00FFFF, "Animations: debugging is ON");
}
else
{
KillTimer(gDebShow);
gDebShow = INVALID_TIMER_ID;
SendClientMessage(playerid, 0xFF00FFFF, "Animations: debugging is OFF");
}
return 1;
}
return 0;
}
Ok, here is a question for you what will happen when two or more players type this command ?
|
//Why?
#pragma unused gDebShow
#pragma unused gDebugPlayerID
//Should be.
new gDebugPlayerID[ MAX_PLAYERS ];
To be honest anyone can make this, no offence to you but its true, anyways why are you using #pragma unused? when you are using those variables?
pawn Код:
|