The Score. - 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: The Score. (
/showthread.php?tid=546625)
The Score. -
OG Killo - 16.11.2014
I can't seem to figure out how to make a small coding script.
Say if a players score is below 10 and they have a weapon in their hands they get instantly banned.
Anyone could help me with this? I'll hand you a rep+.
Re: The Score. -
Boyka96 - 16.11.2014
hii I think this should work.
Код:
forward AntiWeapon();
public AntiWeapon()
{
for(new playerid; playerid<MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid))
{
if(GetPlayerScore(playerid) < 10 && PlayerSpawned[playerid] == 1)
{
new wep = GetPlayerWeapon(playerid);
if(wep==1||wep==2||wep==3||wep==4||wep==5||wep==6||wep==7||wep==8||wep==9||wep==10||wep==11||wep==12||wep==13||wep==14||wep==15||wep==16||wep==17||wep==18||wep==22||wep==23||wep==24||wep==25||wep==26||wep==27||wep==28||wep==29||wep==30||wep==31||wep==32||wep==33||wep==34||wep==35||wep==36||wep==37||wep==38||wep==39||wep==40||wep==41||wep==42||wep==43||wep==44||wep==45)
{
BanUser(playerid, "Weapon hacks", "Anti Cheat");//or whatever function you use to ban a player
}
}
}
}
}
then go to OnGameModeInit() and add this line:
Код:
SetTimer("AntiWeapon", 1000, true);
Note: you need to change "BanUser(playerid, "Weapon hacks", "Anti Cheat");" to the function you use ..
Re: The Score. -
OG Killo - 16.11.2014
I figured a different system, I will rep+ you in 24hours anyways for trying atleast.
Re: The Score. -
Adawg - 16.11.2014
or, this way :
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(weapondid == WEAPONS_ID)
{ // remplace it by the weapons he shouldn't have
if(GetPlayerScore(playerid) > 10) { return 1; } // if he score is > 10, do nothing..
else Ban(playerid); // else he have < 10, we ban him.
}
return 1;
}