Help with my simple anti cheat :D - 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)
+--- Thread: Help with my simple anti cheat :D (
/showthread.php?tid=534026)
Help with my simple anti cheat :D -
PMH - 27.08.2014
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new weapname[32], weapname2[32], string[32];
GetWeaponName(weaponid, weapname, sizeof(weapname));
format(string, sizeof(string), "%s", weapname);
if(GetPVarString(playerid, "Weapon", weapname2, sizeof(weapname2)) != string) return SCM(playerid, -1, "Hello Hacker");
return 1;
}
So i get this error:
error 033: array must be indexed (variable "string")
basiacally what i do is when my script gives someone a weapon, i set pvarstring on him for the weapon name, now on shot i want to detect it but how to match those strings, i keep getting same error
thanks
Re: Help with my simple anti cheat :D -
ThePhenix - 27.08.2014
You can't just simply compare a string of that way:
PHP код:
if(GetPVarString(playerid, "Weapon", weapname2, sizeof(weapname2)) != string)
You could use strcmp.
https://sampwiki.blast.hk/wiki/Strcmp
Re: Help with my simple anti cheat :D -
PMH - 27.08.2014
Quote:
Originally Posted by ThePhenix
You can't just simply compare a string of that way:
PHP код:
if(GetPVarString(playerid, "Weapon", weapname2, sizeof(weapname2)) != string)
You could use strcmp.
|
actually im not good with strcmp, can u help me? plz
Re: Help with my simple anti cheat :D -
Stinged - 27.08.2014
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new weapname[32], weapname2[32];
GetWeaponName(weaponid, weapname, sizeof(weapname));
GetPVarString(playerid, "Weapon", weapname2, sizeof(weapname2));
if (!strcmp(weapname, weapname2, true)) return SCM(playerid, -1, "Hello Hacker");
return 1;
}
Re: Help with my simple anti cheat :D -
PMH - 27.08.2014
Quote:
Originally Posted by Stinged
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { new weapname[32], weapname2[32]; GetWeaponName(weaponid, weapname, sizeof(weapname)); GetPVarString(playerid, "Weapon", weapname2, sizeof(weapname2)); if (!strcmp(weapname, weapname2, true)) return SCM(playerid, -1, "Hello Hacker"); return 1; }
|
I found another way to do, it is better
But thanks a lot for your help, you really made me understand how to match strings! thanks!! +rep'ed