[FilterScript] Animation's codes
#1

Animation's codes FS
Author: Bombo
Version: 1.0.1


This script allows you to see a current animation code alive.



Command:
/animations - switch ON/OFF a debugging



PHP код:
//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(strsizeof(str), "Animation code: %d"anim);
        
SendClientMessage(00x55FFCAFFstr);
        
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(playeridcmdtext[])
{
    if(
strcmp(cmdtext"/animations"true) == 0)
    {
        if(
gDebShow == INVALID_TIMER_ID)
        {
            
gDebugPlayerID playerid;
            
gDebShow SetTimer("ShowAnim"100true);
            
SendClientMessage(playerid0xFF00FFFF"Animations: debugging is ON");
        }
        else
        {
            
KillTimer(gDebShow);
            
gDebShow INVALID_TIMER_ID;
            
SendClientMessage(playerid0xFF00FFFF"Animations: debugging is OFF");
        }
        return 
1;
    }
    return 
0;

Reply
#2

Ok, here is a question for you what will happen when two or more players type this command ?
Reply
#3

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Ok, here is a question for you what will happen when two or more players type this command ?
Nothing bad. The debugging will stop for one of them. But I don't see the reason why two or more players will do it. This command is useful for developers only. So, they can conform their activity.
Reply
#4

That is a bad habit always think dynamic
Reply
#5

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? also gDebugPlayerID should be an array or else only one player can use it.

pawn Код:
//Why?
#pragma unused gDebShow
#pragma unused gDebugPlayerID

//Should be.
new gDebugPlayerID[ MAX_PLAYERS ];
Reply
#6

Quote:
Originally Posted by pds2k12
Посмотреть сообщение
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 Код:
//Why?
#pragma unused gDebShow
#pragma unused gDebugPlayerID
Oh, it's a rudiment. This file was an *.inc firstly.

Quote:
Originally Posted by pds2k12
Посмотреть сообщение
pawn Код:
//Should be.
new gDebugPlayerID[ MAX_PLAYERS ];
The answer is one message upper^
Reply
#7

Looks good!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)