Does this idea have any cons?
#1

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(GetPlayerAnimationIndex(playerid))
    {
        new animlib[32],animname[32],acstring[128], acxstring[128], 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 && UserStats[playerid][Admin] <= 0)
            {
                format(acxstring, 128, "Player %s[%d] has been banned for use of ******", acname, playerid);
                SendClientMessageToAll(RED, acstring);
                BanEx(playerid, "CJ Run");
            }
        }
    }
    return 1;
}
Does this idea have any cons?
Reply
#2

Hmm... Don't use UsePlayerPedAnims in OnGameModeInit, otherwise you'll ban everyone!
Reply
#3

It's in
pawn Код:
public OnPlayerUpdate(playerid)
Reply
#4

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Hmm... Don't use UsePlayerPedAnims in OnGameModeInit, otherwise you'll ban everyone!
Quote:
Originally Posted by Warmachine
Посмотреть сообщение
It's in
pawn Код:
public OnPlayerUpdate(playerid)
I know, I can see that. My point was that if you were to use the UsePlayerPedAnims() native (thus making everyone run like CJ) your code would ban everyone.
Reply
#5

lol that would be an awesome code then btw (talking about what funky said)
Reply
#6

Wouldn't it make the server lag when you have loads of players?
Reply
#7

Quote:
Originally Posted by robintjeh
Посмотреть сообщение
Wouldn't it make the server lag when you have loads of players?
good point actually...
if you used a timer it would reduce the lag
Reply
#8

Quote:
Originally Posted by Sascha
Посмотреть сообщение
good point actually...
if you used a timer it would reduce the lag
Thanks for help!
Reply
#9

Quote:
Originally Posted by robintjeh
Посмотреть сообщение
Wouldn't it make the server lag when you have loads of players?
And here we go again. Having code in OnPlayerUpdate isn't bad, it's just that you need to decide wisely what you can and cannot do in it. The idea of OnPlayerUpdate being bad only comes from some weirdos wondering why their server is lagging while they're saving player data every time OnPlayerUpdate gets called, using dini.
Reply
#10

You can optimize it by finding out the animation ids and checking for these. What you are doing now is getting the animation index, convert it to strings, and compare these strings two times. Just comparing some numbers will be much faster.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)