Anti-Cheat command.
#1

I'm trying to make an anticheat...it's kinda different cause it is used by a command, but i just want to get rid of these errors and i can't
Код:
CMD:achh(playerid, params[])
{
	new userid, Float:x, Float:y, Float:z, Float:ohp, Float:oar, Float:nhp, Float:nar;
	if(PlayerInfo[playerid][pAdmin] < 2) return SCM(playerid,COLOR_ERROR,"Error: You must be admin level 2!");
	if(sscanf(params, "u", userid)) return SCM(playerid,COLOR_GREY,"Usage: /achh [UserID]");
	else if(userid == INVALID_PLAYER_ID) return SCM(playerid,COLOR_ERROR,"Error: Player is not connected!");
	else if(userid == playerid) return SCM(playerid,COLOR_ERROR,"Error: You cannot use this command on yourself!");
	else
	{
		ohp == GetPlayerHealth(userid);
		oar == GetPlayerArmour(userid);
		GetPlayerPos(userid, x, y, z);
		CreateExplosion(x, y, z, 7, 10.0);
		nhp == GetPlayerHealth(userid);
		nar == GetPlayerArmour(userid);
		CreateExplosion(x, y ,z , 10, 10.0);
		SCM(playerid,0xFF4D4DFF,"{FF4D4D}[ANTI-CHEAT]: {DED9D9}Explosion created, wait for results!");
		if(ohp != nhp && oar != nar) return SCM(playerid,"{FF4D4D}[ANTI-CHEAT] {DED9D9}RESULTS: Player is not having HH!"), SCM(userid,-1,"{FF4D4D}[ANTI-CHEAT]: {DED9D9}You've been exploded due Hack Acusations!");
		if(ohp == nhp && oar == nar) return SCM(playerid,"{FF4D4D}[ANTI-CHEAT]: Player is having HH!"), SCM(userid,COLOR_ERROR,"[ANTI-CHEAT]: You've been kicked from the server! Reason: Using HealthHack");
	}
	return 1;
}
Annnndd the errors and warnings :/
Код:
C:\Users\Seby\Desktop\SampServer\gamemodes\RSV.pwn(937) : warning 202: number of arguments does not match definition
C:\Users\Seby\Desktop\SampServer\gamemodes\RSV.pwn(937) : warning 215: expression has no effect
C:\Users\Seby\Desktop\SampServer\gamemodes\RSV.pwn(938) : warning 202: number of arguments does not match definition
C:\Users\Seby\Desktop\SampServer\gamemodes\RSV.pwn(938) : warning 215: expression has no effect
C:\Users\Seby\Desktop\SampServer\gamemodes\RSV.pwn(941) : warning 202: number of arguments does not match definition
C:\Users\Seby\Desktop\SampServer\gamemodes\RSV.pwn(941) : warning 215: expression has no effect
C:\Users\Seby\Desktop\SampServer\gamemodes\RSV.pwn(942) : warning 202: number of arguments does not match definition
C:\Users\Seby\Desktop\SampServer\gamemodes\RSV.pwn(942) : warning 215: expression has no effect
C:\Users\Seby\Desktop\SampServer\gamemodes\RSV.pwn(945) : error 035: argument type mismatch (argument 2)
C:\Users\Seby\Desktop\SampServer\gamemodes\RSV.pwn(946) : error 035: argument type mismatch (argument 2)

Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#2

Try this,
Код:
CMD:achh(playerid, params[])
{
	new userid, Float:x, Float:y, Float:z, Float:ohp, Float:oar, Float:nhp, Float:nar;
	if(PlayerInfo[playerid][pAdmin] < 2) return SCM(playerid,COLOR_ERROR,"Error: You must be admin level 2!");
	if(sscanf(params, "u", userid)) return SCM(playerid,COLOR_GREY,"Usage: /achh [UserID]");
	else if(userid == INVALID_PLAYER_ID) return SCM(playerid,COLOR_ERROR,"Error: Player is not connected!");
	else if(userid == playerid) return SCM(playerid,COLOR_ERROR,"Error: You cannot use this command on yourself!");
	else
	{
		ohp = GetPlayerHealth(userid);
		oar = GetPlayerArmour(userid);
		GetPlayerPos(userid, x, y, z);
		CreateExplosion(x, y, z, 7, 10.0);
		nhp = GetPlayerHealth(userid);
		nar = GetPlayerArmour(userid);
		CreateExplosion(x, y ,z , 10, 10.0);
		SCM(playerid,0xFF4D4DFF,"{FF4D4D}[ANTI-CHEAT]: {DED9D9}Explosion created, wait for results!");
		if(ohp != nhp && oar != nar) return SCM(playerid,-1,"{FF4D4D}[ANTI-CHEAT] {DED9D9}RESULTS: Player is not having HH!"), SCM(userid,-1,"{FF4D4D}[ANTI-CHEAT]: {DED9D9}You've been exploded due Hack Acusations!");
		if(ohp == nhp && oar == nar) return SCM(playerid,-1,"{FF4D4D}[ANTI-CHEAT]: Player is having HH!"), SCM(userid,COLOR_ERROR,"[ANTI-CHEAT]: You've been kicked from the server! Reason: Using HealthHack");
	}
	return 1;
}
Reply
#3

Still getting warnings on lines:
nhp = GetPlayerHealth(userid);
nar = GetPlayerArmour(userid);
ohp = GetPlayerHealth(userid);
oar = GetPlayerArmour(userid);
Reply
#4

Solved by myself, turning

nhp = GetPlayerHealth(userid);
nar = GetPlayerArmour(userid);
ohp = GetPlayerHealth(userid);
oar = GetPlayerArmour(userid);

to

nhp = GetPlayerHealth(userid, nhp);
nar = GetPlayerArmour(userid, nar);
ohp = GetPlayerHealth(userid, ohp);
oar = GetPlayerArmour(userid, oar);
Reply
#5

GetPlayerHealth(userid, nhp);
GetPlayerArmour(userid, nar);
GetPlayerHealth(userid, ohp);
GetPlayerArmour(userid, oar);
what are you even building there?
Reply
#6

Im newbie in scripting, so take it easy... I'm learning
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)