How can i make this work? - 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: How can i make this work? (
/showthread.php?tid=134798)
How can i make this work? -
ScottCFR - 17.03.2010
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
Re: How can i make this work? -
¤Adas¤ - 17.03.2010
// Anti-Cheat
//** Anti Weapon
{
SetTimer("Weap", 10000, true);
if(GetPlayerWeapon(playerid) == 3

return Ban(playerid);
}
// Anti-Cheat
Re: How can i make this work? -
ScottCFR - 17.03.2010
Now i get Unidentified symbol "playerid"
Re: How can i make this work? -
Correlli - 17.03.2010
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.
Re: How can i make this work? -
ScottCFR - 17.03.2010
under
Код:
public OnGameModeInit()
Re: How can i make this work? -
Correlli - 17.03.2010
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.
Re: How can i make this work? -
ScottCFR - 17.03.2010
Код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerWeapons(playerid) == 38) return Ban(playerid)
}

?
Re: How can i make this work? -
Correlli - 17.03.2010
pawn Код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerWeapon(playerid) == 38) Ban(playerid);
return true;
}
Re: How can i make this work? -
Fedee! - 17.03.2010
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;
}
Re: How can i make this work? -
biltong - 17.03.2010
Quote:
Originally Posted by Fedee!
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { if(GetPlayerWeapon(killerid) == 38) Ban(killerid); return 1; }
|
Best solution.