SA-MP Forums Archive
Some problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Some problem (/showthread.php?tid=275367)



Some problem - Trol_Patrol - 09.08.2011

I put this code on OnPlayerUpdate:
if(GetPlayerAnimationIndex(playerid))
{
new animlib[32],animname[32],acname[MAX_PLAYER_NAME];
GetPlayerName(playerid, acname, sizeof(acname));
GetAnimationName(GetPlayerAnimationIndex(playerid) ,animlib,32,animname,32);
if(strcmp(animlib, "PED", true) == 0)
{
if(strcmp(animname, "RUN_PLAYER", true) == 0)
{
format(string, sizeof(string), "AdmWarn: %s[%d] possibly CJ Running", acname,playerid);
ABroadCast(COLOR_YELLOW,string,1);
}
}
return 1;
}

It works good but when the player is CJ running it spamms the whole chat..
anyone can help ?


Respuesta: Some problem - RatHack - 09.08.2011

Try this:

pawn Код:
if(GetPlayerAnimationIndex(playerid))
{
new animlib[32],animname[32],acname[MAX_PLAYER_NAME];
GetPlayerName(playerid, acname, sizeof(acname));
GetAnimationName(GetPlayerAnimationIndex(playerid) ,animlib,32,animname,32);
if(strcmp(animlib, "PED", true) == 0)
{
if(strcmp(animname, "RUN_PLAYER", true) == 0)
{
format(string, sizeof(string), "AdmWarn: %s[%d] possibly CJ Running", acname,playerid);
// Your sendmessagetoadmins
ABroadCast(COLOR_YELLOW,string,1);
}
}
return 1;
}



Re: Some problem - Trol_Patrol - 09.08.2011

The code you gave works, but it spamming the all admin chat like:
AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running

AdmWarn: %s[%d] possibly CJ Running


Respuesta: Some problem - RatHack - 09.08.2011

pawn Код:
ABroadCast(COLOR_YELLOW,string,1);
Remove the 1 at the end

pawn Код:
ABroadCast(COLOR_YELLOW,string);
Try that


Re: Some problem - MadeMan - 09.08.2011

What should it do then?


Re: Some problem - Jay. - 09.08.2011

nevermind


Re: Some problem - Trol_Patrol - 09.08.2011

never mind


Re: Some problem - MadeMan - 09.08.2011

pawn Код:
new RunWarning[MAX_PLAYERS];
pawn Код:
if(GetPlayerAnimationIndex(playerid))
{
    new animlib[32],animname[32],acname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, acname, sizeof(acname));
    GetAnimationName(GetPlayerAnimationIndex(playerid) ,animlib,32,animname,32);
    if(strcmp(animlib, "PED", true) == 0 && strcmp(animname, "RUN_PLAYER", true) == 0)
    {
        if(RunWarning[playerid] == 0)
        {
            format(string, sizeof(string), "AdmWarn: %s[%d] possibly CJ Running", acname,playerid);
            ABroadCast(COLOR_YELLOW,string,1);
            RunWarning[playerid] = 1;
        }
    }
    else
    {
        RunWarning[playerid] = 0;
    }
    return 1;
}



Re: Some problem - Trol_Patrol - 09.08.2011

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
pawn Код:
new RunWarning[MAX_PLAYERS];
pawn Код:
if(GetPlayerAnimationIndex(playerid))
{
    new animlib[32],animname[32],acname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, acname, sizeof(acname));
    GetAnimationName(GetPlayerAnimationIndex(playerid) ,animlib,32,animname,32);
    if(strcmp(animlib, "PED", true) == 0 && strcmp(animname, "RUN_PLAYER", true) == 0)
    {
        if(RunWarning[playerid] == 0)
        {
            format(string, sizeof(string), "AdmWarn: %s[%d] possibly CJ Running", acname,playerid);
            ABroadCast(COLOR_YELLOW,string,1);
            RunWarning[playerid] = 1;
        }
    }
    else
    {
        RunWarning[playerid] = 0;
    }
    return 1;
}
thanks, its not spamming now