Pvars to normal variables? (code by cessil) -
PawnoQ - 04.02.2012
hi,
could someone please show me how i would convert this system using pvars to normal variables?
That would be great, i tried much but it didnt work...
pawn Код:
ttemp[i] = 0;
for(new w = 0; w < 13; w++)
{
GetPlayerWeaponData(i, w ,cwep ,camo);
format(cstringw,sizeof(cstringw),"wslot%d",w);
if(GetPVarInt(i,cstringw) != cwep && camo != 0)
{
ttemp[i]++;
}
}
if(ttemp[i] != 0)
{
//weapon hacks detected!
}
stock GiveWeapon(playerid,weapon,ammo)
{
new wstr[10];
format(wstr,sizeof(wstr),"wslot%d",GetWeaponSlot(weapon));
SetPVarInt(playerid,wstr,weapon);
GivePlayerWeapon(playerid,weapon,ammo);
return 1;
}
Re: Pvars to normal variables? (code by cessil) -
PawnoQ - 04.02.2012
i mean smth. like this:
pawn Код:
NormalVar[playerid][0]=wstr;
NormalVar[playerid][1]=weapon;
instead of this:
pawn Код:
SetPVarInt(playerid,wstr,weapon);
But i dont know exactly how to do it so i need help

I hope you can understand better now how i mean it
Re: Pvars to normal variables? (code by cessil) -
cessil - 04.02.2012
that was a very old tutorial thread, for a better system you should read this instead
http://forum.sa-mp.com/showthread.ph...22#post1050022
Re: Pvars to normal variables? (code by cessil) -
PawnoQ - 04.02.2012
pawn Код:
stock GiveWeapon(playerid,weapon,ammo)
{
new str[10];
format(str,sizeof(str),"weap%d",weapon); //format to set the variable
SetPVarInt(playerid,str,1); //the script now know that the player has had this weapon
format(str,sizeof(str),"wslot%d",GetWeaponSlot(weapon)); //what weapon is in which slot
SetPVarInt(playerid,str,weapon);
GivePlayerWeapon(playerid,weapon,ammo);
}
mhh, i know thx

But the give weapon stock is the same i think?
The main reason why i want to convert this to normal variables is that i want only to reset the players weapons if he cheated them. (and not kick him)
I know how it works with normal variables (cause i have to reset them after punishment) but i dont know how to do it with pvars as pvars as far as i know are only resettet after a player disconnects.
Could you provide me an example?
That would be sooo awesome, please
Re: Pvars to normal variables? (code by cessil) -
cessil - 04.02.2012
use DeletePVar(playerid,pvar[]); to reset a PVar
I used PVars so you can use and access the variables in all scripts like an anti-cheat filterscript, game mode, race filterscript ect.
Re: Pvars to normal variables? (code by cessil) -
PawnoQ - 05.02.2012
pawn Код:
ttemp[i] = 0;
for(new w = 0; w < 13; w++)
{
GetPlayerWeaponData(i, w ,cwep ,camo);
format(cstringw,sizeof(cstringw),"wslot%d",w);
if(GetPVarInt(i,cstringw) != cwep && camo != 0)
{
ttemp[i]++;
}
}
if(ttemp[i] != 0)
{
//weapon hacks detected!
}
Ah ok, thx a lot!
So i had only to delete the pvar there where i added the commented line in the code above?
Also in ur new anti cheat tutorial there is no checking example for the weapon hack, only the stock for giving the weapon.
Could u give me an example for such a checking code?
Would really appreciate that
Re: Pvars to normal variables? (code by cessil) -
PawnoQ - 05.02.2012
someone can give me an example with normal variables here please?
Would really be happy about it

+rep ofc
AW: Pvars to normal variables? (code by cessil) -
BigETI - 05.02.2012
pawn Код:
#define MAX_WEAPON_SLOTS 13
enum AC_Infos
{
AC_Weapon[MAX_WEAPON_SLOTS],
bool:AC_WeaponSync[MAX_WEAPON_SLOTS],
AC_Ammo[MAX_WEAPON_SLOTS],
bool:AC_AmmoSync[MAX_WEAPON_SLOTS],
//You can add here also some another things like money, skin, health and/or armour informations in this enum.
};
new AC_Info[MAX_PLAYERS][AC_Infos]; //Our Player variable where we will store the AC informations.