What is wrong in this code?
#1

Guys here is my antihack script.Now see wht is wrong in it.
PHP код:
//Antihack
#include <a_samp>
#define COLOR_YELLOW "{FFFF00}"
new Text:banmessage;
new 
dm[MAX_PLAYERS];
public 
OnFilterScriptInit()
{
    
printf("Anti Minigun By [A]Gamer_007 is loading now");
    
printf("Anti Minigun By [A]Gamer_007 loaded");
    
printf("NO WEAPON HACKS IN YOUR SERVER.ENJOY");
    
banmessage TextDrawCreate(190,200,"~r~Nice Hacks but Here they are not allowed.~n~~y~You are banned from this server.");
    
TextDrawFont(banmessage2);
    
TextDrawLetterSize(banmessage0.61.0);
    
TextDrawSetShadow(banmessage0);
    
TextDrawSetOutline(banmessage1);
    return 
1;
}
stock PlayerName(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    return 
name;
}
CMD:dm(playerid,parms[])
{
 
dm(playerid) = 1;//set a palyer dm value to 1
 //My tele co ordinate here
 
return 1;
 }
public 
OnPlayerUpdate(playerid)
{
   if(
dm(playerid) == 1){
   return 
1;
   }
   else
   {
   new 
string[128],Weapon,Ammo;
   
GetPlayerWeaponData(playerid7Weapon,Ammo);
   if(
Weapon == 38 && !IsPlayerAdmin(playerid)) {
   
format(string,128,"{FF0000}%s[%d] Has Been Banned From Server.[Reason: Minigun Hack]",PlayerName(playerid),playerid);
   
SendClientMessageToAll(0xFF0000AA,string);
   
TextDrawShowForPlayer(playeridbanmessage);
   
Ban(playerid);
   }
   if(
Weapon == 36 && !IsPlayerAdmin(playerid)) {
   
format(string,128,"{FF0000}%s[%d] Has Been Banned From Server.[Reason: Heat Saker Hack]",PlayerName(playerid),playerid);
   
SendClientMessageToAll(0xFF0000AA,string);
   
TextDrawShowForPlayer(playeridbanmessage);
   
Ban(playerid);
   }
   if(
Weapon == 35 && !IsPlayerAdmin(playerid)) {
   
format(string,128,"{FF0000}%s[%d] Has Been Banned From Server.[Reason: Rocket Launcher Hack]",PlayerName(playerid),playerid);
   
SendClientMessageToAll(0xFF0000AA,string);
   
TextDrawShowForPlayer(playeridbanmessage);
   
Ban(playerid);
   }
   return 
1;

Reply
#2

Why are you using OnPlayerUpdate?

Use a timer. OnPlayerUpdate is worst thing callback to use for Anti-Cheats.

Anyway what's the problem?
Reply
#3

1) Change dm(playerid) to dm[playerid]
2) Under OnPlayerUpdate
new Weapon = GetPlayerWeapon(playerid);
and of course, remove "Weapon" and "Ammo".
Reply
#4

Quote:

C:\Users\DEVILS\Desktop\tri.pwn(2 : error 021: symbol already defined: "dm"
C:\Users\DEVILS\Desktop\tri.pwn(2 : error 021: symbol already defined: "dm"
C:\Users\DEVILS\Desktop\tri.pwn(31) : error 010: invalid function or declaration
C:\Users\DEVILS\Desktop\tri.pwn(35) : error 012: invalid function call, not a valid address
C:\Users\DEVILS\Desktop\tri.pwn(35) : warning 215: expression has no effect
C:\Users\DEVILS\Desktop\tri.pwn(35) : error 001: expected token: ";", but found ")"
C:\Users\DEVILS\Desktop\tri.pwn(35) : error 029: invalid expression, assumed zero
C:\Users\DEVILS\Desktop\tri.pwn(35) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.
6 Errors.
Reply
#5

3 errors
Quote:

C:\Users\DEVILS\Desktop\tri.pwn(2 : error 021: symbol already defined: "dm"
C:\Users\DEVILS\Desktop\tri.pwn(31) : error 010: invalid function or declaration
C:\Users\DEVILS\Desktop\tri.pwn(6 : error 030: compound statement not closed at the end of file (started at line 35)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

Reply
#6

Now change CMD:dm(playerid,parms[]) to CMD:dm1(playerid,parms[])
Reply
#7

C:\Users\DEVILS\Desktop\tri.pwn(69) : warning 203: symbol is never used: "dm1"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.

on changing dm to dm1
Reply
#8

http://forum.sa-mp.com/showthread.ph...rrors+warnings

You're probably getting the error 21 because you have a variable named the same as the command.


Romel, OPU is a great callback to use in an anti cheat, read my thread about anti-cheat tips for more info
Quote:
Originally Posted by Romel
Посмотреть сообщение
Use a timer. OnPlayerUpdate is worst thing callback to use for Anti-Cheats.
Reply
#9

Make sure you have #include <zcmd> at the top.
Reply
#10

PHP код:
#include <zcmd> 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)