Does this idea have any cons? -
Warmachine - 04.12.2011
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?
Re: Does this idea have any cons? -
Ash. - 04.12.2011
Hmm... Don't use UsePlayerPedAnims in OnGameModeInit, otherwise you'll ban everyone!
Re: Does this idea have any cons? -
Warmachine - 04.12.2011
It's in
pawn Код:
public OnPlayerUpdate(playerid)
Re: Does this idea have any cons? -
Ash. - 04.12.2011
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.
Re: Does this idea have any cons? -
Sascha - 04.12.2011
lol that would be an awesome code then btw

(talking about what funky said)
Re: Does this idea have any cons? -
robintjeh - 04.12.2011
Wouldn't it make the server lag when you have loads of players?
Re: Does this idea have any cons? -
Sascha - 04.12.2011
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
Re: Does this idea have any cons? -
Warmachine - 05.12.2011
Quote:
Originally Posted by Sascha
good point actually...
if you used a timer it would reduce the lag
|
Thanks for help!
Re: Does this idea have any cons? -
Hiddos - 05.12.2011
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.
Re: Does this idea have any cons? -
Mauzen - 05.12.2011
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.