Anti Weapon hack - 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: Anti Weapon hack (
/showthread.php?tid=235748)
Anti Weapon hack -
aqu - 06.03.2011
Hello,When I compiling I am getting erros.
my anti weapon script:
Code:
// On the top
new minigun[MAX_PLAYERS];
forward WeaponCheck( );
// Then in weapon check
public WeaponCheck( )
{
for(new i=0; i<MAX_PLAYERS; i++){
if(GetPlayerWeapon(i) == 38 && minigun[playerid]=0)
{
new pname[200];
new string[200];
GetPlayerName(i, pname, sizeof(pname));
format(string, sizeof(string), "-Server- %s has been banned from this server(Reason: Minigun hack)", pname);
SendClientMessageToAll(COLOR_RED,string);
Ban(i);
}
}
}
// Then if player gets some where minigun in script I additing "minigun[playerid]=1" .
And I am getting these errors:
Code:
C:\Users\bendra\Desktop\Samp Serveriai\Serv\gamemodes\LSTW2v2.pwn(780) : error 017: undefined symbol "playerid"
C:\Users\bendra\Desktop\Samp Serveriai\Serv\gamemodes\LSTW2v2.pwn(780) : warning 215: expression has no effect
C:\Users\bendra\Desktop\Samp Serveriai\Serv\gamemodes\LSTW2v2.pwn(780) : error 001: expected token: ";", but found ")"
C:\Users\bendra\Desktop\Samp Serveriai\Serv\gamemodes\LSTW2v2.pwn(780) : error 029: invalid expression, assumed zero
C:\Users\bendra\Desktop\Samp Serveriai\Serv\gamemodes\LSTW2v2.pwn(780) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Any help?
Re: Anti Weapon hack -
dice7 - 06.03.2011
minigun[i]==0
Re: Anti Weapon hack -
Calgon - 06.03.2011
pawn Code:
#include <a_samp>
public WeaponCheck() {
for(new i = 0; i < MAX_PLAYERS; i++) { // Neater loop
if(GetPlayerWeapon(i) == 38 && minigun[playerid] == 0) { // You need to use two equal operators.
new
pname[MAX_PLAYER_NAME], // You only need ~24 cells!
string[91]; // You only need ~91 cells!
GetPlayerName(i, pname, sizeof(pname)); // Get the name
format(string, sizeof(string), "-Server- %s has been banned from this server (Reason: Minigun hack)", pname); // Format the string
SendClientMessageToAll(COLOR_RED,string); // Message everyone
Ban(i); // Ban that player
}
}
return 1;
}
EDIT: Beaten to it by dice7.