whats wrong with this code?
#1

Title says all.

pawn Код:
if(GetPlayerWeapon(playerid) == 46) // bans all but parachute.
        {
        return 1;
        }
            else if(GetPlayerWeapon(playerid) > 0)
            {
            SendClientMessage(playerid, 0x99FFFF, "Weapon hacks are not allowed, you have been banned!");
            SendClientMessage(playerid, 0x99FFFF, "If you think we have made a mistake, please visit our website at ##########");
            SendClientMessage(playerid, 0x99FFFF, "Please take a screenshot of this as proof! Thanks!");
                new Pname[24], String[65]; GetPlayerName(playerid, Pname, 24);
                format(String, sizeof(String), "%s Has been banned by KillerBot for weapon hacks!", Pname);
                SendClientMessageToAll(0xF600A5AA, String);
                print(String);
                BanLog(String);
                BanEx(playerid, "Weapon Hacks Detected by Killerbot");
            }
        }
Gives 6 errors.


They are..

C:\Users\Yamom(3781) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(3843) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(3899) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(3914) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(3947) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(4103) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(4125) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(4145) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(5630) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(5756) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(5756) : warning 219: local variable "String" shadows a variable at a preceding level
C:\Users\Yamom(5763) : warning 209: function "OnPlayerUpdate" should return a value
C:\Users\Yamom(5765) : error 021: symbol already defined: "GetPlayerArmour"
C:\Users\Yamom(5766) : error 010: invalid function or declaration
C:\Users\Yamom(5769) : error 021: symbol already defined: "GetPlayerName"
C:\Users\Yamom(5774) : error 021: symbol already defined: "BanEx"
C:\Users\Yamom(5776) : error 010: invalid function or declaration
C:\Users\Yamom(6196) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(6485) : warning 219: local variable "String" shadows a variable at a preceding level
C:\Users\Yamom(6891) : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(692 : warning 219: local variable "Pname" shadows a variable at a preceding level
C:\Users\Yamom(715 : warning 203: symbol is never used: "Armour"
C:\Users\Yamom(715 : warning 203: symbol is never used: "CDMSpawn"
C:\Users\Yamom(715 : warning 203: symbol is never used: "Pname"
C:\Users\Yamom(715 : warning 203: symbol is never used: "String"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#2

What do the errors say?
Reply
#3

added errors
Reply
#4

after removing some redundant closing brackets (last 2) and excluding the ban-command, the snipped did its job. i presume the BanLog is a function in your script... please post the errors you get and add the line numbers as comment, f.ex //1234
ah, errors added: lets start with the simplest
add a
Код:
return 1;
at the end of your "OnPlayerUpdate"
then leets see what happens next
Reply
#5

Err.. already there...

pawn Код:
public OnPlayerUpdate(playerid)
{
        if(GetPlayerWeapon(playerid) == 46) // bans all but parachute.
        {
        return 1;
        }
            else if(GetPlayerWeapon(playerid) > 0)
            {
            SendClientMessage(playerid, 0x99FFFF, "Weapon hacks are not allowed, you have been banned!");
            SendClientMessage(playerid, 0x99FFFF, "If you think we have made a mistake, please visit our website at http://www.spserv.smfnew.com[url=http://][/url]");
            SendClientMessage(playerid, 0x99FFFF, "Please take a screenshot of this as proof! Thanks!");
                new Pname[24], String[65]; GetPlayerName(playerid, Pname, 24);
                format(String, sizeof(String), "%s Has been banned by KillerBot for weapon hacks!", Pname);
                SendClientMessageToAll(0xF600A5AA, String);
                print(String);
                BanLog(String);
                BanEx(playerid, "Weapon Hacks Detected by Killerbot");
            }
        }
        new Float:Armour;
        GetPlayerArmour(playerid, Armour);
        if(Armour > 0)
        {
          SendClientMessage(playerid, 0x99FFFF, "Armor hacks are not allowed, you have been banned! If you think we have made a mistake, please visit our website at spserv.smfnew.com.");
            new Pname[24], String[65]; GetPlayerName(playerid, Pname, 24);
            format(String, sizeof(String), "%s has been banned by KillerBot for Armor hacks!", Pname);
            SendClientMessageToAll(0xF600A5AA, String);
            print(String);
            BanLog(String);
            BanEx(playerid, "Weapon Hacks Detected by Killerbot");
        }
    return 1;
}
Reply
#6

simply remove one closing bracket in that middle line, its closing your function...
Код:
		BanEx(playerid, "Weapon Hacks Detected by Killerbot");
	}
	}
	new Float:Armour;
your code will look like this afterwards:
Код:
		BanEx(playerid, "Weapon Hacks Detected by Killerbot");
	}
	new Float:Armour;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)