How can i make this work?
#1

I'm starting to make my own anti-cheat but am having some troubles.

Heres the code:.
Код:
	// Anti-Cheat
	//** Anti Weapon
	{
	  SetTimer("Weap", 10000, true);
	  if GetPlayerWeapon(playerid) == 38); return Ban(playerid);
	}
	// Anti-Cheat
Heres the errors:
Код:
(551) : error 017: undefined symbol "playerid"
(551) : error 029: invalid expression, assumed zero
(551) : warning 215: expression has no effect
(551) : error 017: undefined symbol "playerid"
(551) : fatal error 107: too many error messages on one line
Reply
#2

// Anti-Cheat
//** Anti Weapon
{
SetTimer("Weap", 10000, true);
if(GetPlayerWeapon(playerid) == 3 return Ban(playerid);
}
// Anti-Cheat
Reply
#3

Now i get Unidentified symbol "playerid"
Reply
#4

And where do you have this code, in which callback/function? Because you can't have it in a callback/function that doesn't have the correct player-ID parameter.
Reply
#5

under

Код:
public OnGameModeInit()
Reply
#6

OnGameModeInit callback doesn't have any parameter. You should put your GetPlayerWeapon check code in some timer or OnPlayerUpdate callback, but don't return the Ban function if you have any other code after that check.
Reply
#7

Код:
public OnPlayerUpdate(playerid)
{
    if(GetPlayerWeapons(playerid) == 38) return Ban(playerid)
}
?
Reply
#8

pawn Код:
public OnPlayerUpdate(playerid)
{
  if(GetPlayerWeapon(playerid) == 38) Ban(playerid);
  return true;
}
Reply
#9

Quote:
Originally Posted by Don Correlli
pawn Код:
public OnPlayerUpdate(playerid)
{
  if(GetPlayerWeapon(playerid) == 38) Ban(playerid);
  return true;
}
Toooooo much CPU usage, I would set a timer of 1 sec.

OR.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(GetPlayerWeapon(killerid) == 38) Ban(killerid);
  return 1;
}
Reply
#10

Quote:
Originally Posted by Fedee!
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(GetPlayerWeapon(killerid) == 38) Ban(killerid);
  return 1;
}
Best solution.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)