whats wrong with this code? - 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: whats wrong with this code? (
/showthread.php?tid=120744)
whats wrong with this code? -
DiddyBop - 12.01.2010
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.
Re: whats wrong with this code? -
Stah - 12.01.2010
What do the errors say?
Re: whats wrong with this code? -
DiddyBop - 12.01.2010
added errors
Re: whats wrong with this code? -
Babul - 12.01.2010
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
at the end of your "OnPlayerUpdate"
then leets see what happens next
Re: whats wrong with this code? -
DiddyBop - 12.01.2010
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;
}
Re: whats wrong with this code? -
Babul - 12.01.2010
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;