static const WeaponSlots[47] =
{
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10,
10, 10, 10, 10, 8, 8, 8, -1, -1, -1,
2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 4, 6,
6, 7, 7, 7, 7, 8, 12, 9, 9, 9, 11,
11, 11
};
GivePlayerGMoney(playerid,moneyy)GivePlayerMoney(p layerid,moneyy);
stock SetPlayerMoney(playerid,moneyy)
{
PD->money[playerid]=moneyy;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PD->money[playerid]);
}
stock GivePlayerMoney_(playerid, moneyy)
{
PD->money[playerid]+=moneyy;
GivePlayerMoney(playerid, moneyy);
}
#define GivePlayerMoney GivePlayerMoney_
stock GetPlayerMoney_(playerid)
{
return PD->money[playerid];
}
#define GetPlayerMoney GetPlayerMoney_
stock ResetPlayerMoney_(playerid)
{
PD->money[playerid]=0;
ResetPlayerMoney(playerid);
}
#define ResetPlayerMoney ResetPlayerMoney_
SetPlayerGScore(playerid,scor)SetPlayerScore(playe rid,scor);
stock GivePlayerScore(playerid, scor)
{
PD->score[playerid][PVG->Int->RoomData[playerid]]+=scor;
SetPlayerScore(playerid,PD->score[playerid][PVG->Int->RoomData[playerid]]);
}
stock SetPlayerScore_(playerid,scor)
{
PD->score[playerid][PVG->Int->RoomData[playerid]]=scor;
}
#define SetPlayerScore SetPlayerScore_
stock GetPlayerScore_(playerid)
{
return PD->score[playerid][PVG->Int->RoomData[playerid]];
}
#define GetPlayerScore GetPlayerScore_
stock _SetPlayerPos(playerid, Float: x, Float: y, Float: z)
{
SetPVarFloat(playerid, "LastPositionX", x), SetPVarFloat(playerid, "LastPositionY", y), SetPVarFloat(playerid, "LastPositionZ", z);
return SetPlayerPos(playerid, x, y, z);
}
#if defined _ALS_SetPlayerPos
#undef SetPlayerPos
#else
#define _ALS_SetPlayerPos
#endif
#define SetPlayerPos _SetPlayerPos
stock _SetVehicleVelocity(vehicleid, Float: x, Float: y, Float: z)
{
SetGVarInt("SonHiz",floatround(floatsqroot((x * x + y * y + z * z)) * 200.2),vehicleid);
return SetVehicleVelocity(vehicleid, x, y, z);
}
#if defined _ALS_SetVehicleVelocity
#undef SetVehicleVelocity
#else
#define _ALS_SetVehicleVelocity
#endif
#define SetVehicleVelocity _SetVehicleVelocity
stock _GivePlayerWeapon(playerid, weaponid, ammo)
{
new variableName[20];
format(variableName, sizeof(variableName), "PlayerWeapon%d", WeaponSlots[weaponid]);
SetPVarInt(playerid, variableName, weaponid);
return GivePlayerWeapon(playerid, weaponid, ammo);
}
#if defined _ALS_GivePlayerWeapon
#undef GivePlayerWeapon
#else
#define _ALS_GivePlayerWeapon
#endif
#define GivePlayerWeapon _GivePlayerWeapon
stock _SetPlayerVelocity(playerid, Float: x, Float: y, Float: z)
{
SetPVarInt(playerid, "SonHiz",floatround(floatsqroot((x * x + y * y + z * z)) * 200.2));
return SetPlayerVelocity(playerid, x, y, z);
}
#if defined _ALS_SetPlayerVelocity
#undef SetPlayerVelocity
#else
#define _ALS_SetPlayerVelocity
#endif
#define SetPlayerVelocity _SetPlayerVelocity
stock _TogglePlayerSpectating(playerid, spectate)
{
TogglePlayerSpectating(playerid, spectate);
SetPVarInt(playerid,"specdurum",spectate);
}
#if defined _ALS_TogglePlayerSpectating
#undef TogglePlayerSpectating
#else
#define _ALS_TogglePlayerSpectating
#endif
#define TogglePlayerSpectating _TogglePlayerSpectating
GetVehicleSpeed(vehicleID)
{
new Float: vehiclesVelocity[3];
GetVehicleVelocity(vehicleID, vehiclesVelocity[0], vehiclesVelocity[1], vehiclesVelocity[2]);
return floatround(floatsqroot((vehiclesVelocity[0] * vehiclesVelocity[0] + vehiclesVelocity[1] * vehiclesVelocity[1] + vehiclesVelocity[2] * vehiclesVelocity[2])) * 200.2);
}
GetPlayerSpeed(playerid)
{
new Float: vehiclesVelocity[3];
GetPlayerVelocity(playerid, vehiclesVelocity[0], vehiclesVelocity[1], vehiclesVelocity[2]);
return floatround(floatsqroot((vehiclesVelocity[0] * vehiclesVelocity[0] + vehiclesVelocity[1] * vehiclesVelocity[1] + vehiclesVelocity[2] * vehiclesVelocity[2])) * 200.2);
}
function DetectingHack()
{
foreach(new playerid:Player)
{
if(!IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT || GetPlayerState(playerid) == PLAYER_STATE_SPAWNED)
{
if(GetPlayerSurfingVehicleID(playerid) == INVALID_VEHICLE_ID && GetPlayerSurfingObjectID(playerid) == INVALID_OBJECT_ID && GetPVarInt(playerid,"aractandustum") < GetTickCount())
{
if(!IsPlayerInRangeOfPoint(playerid,90,GetPVarFloa t(playerid, "FP_LastPositionX"),GetPVarFloat(playerid, "FP_LastPositionY"),GetPVarFloat(playerid, "FP_LastPositionZ")))
{
SetPVarInt(playerid,"suphe1",GetPVarInt(playerid," suphe1")+1);
}
new ivme,speed;
ivme = (speed=GetPlayerSpeed(playerid) - GetPVarInt(playerid,"SonPHiz"));
SetPVarInt(playerid,"SonPHiz",speed);
if(ivme > 175)SetPVarInt(playerid,"suphe2",GetPVarInt(player id,"suphe2")+1);
}
}
}else
{
new ivme,speed;
ivme = (speed=GetVehicleSpeed(GetPlayerVehicleID(playerid )) - GetGVarInt("Sonhiz",GetPlayerVehicleID(playerid))) ;
SetGVarInt("SonHiz",speed,GetPlayerVehicleID(playe rid));
if(ivme > 135)
{
SetPVarInt(playerid,"suphe6",GetPVarInt(playerid," suphe6")+1);
if(PVG->Int->RoomData[playerid] == 2)SetVehicleVelocity(GetPlayerVehicleID(playerid), 0,0,0);
}
}
}
return 1;
}
hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(GetPVarInt(playerid,"AntiFloodDialogMagNeteC") > GetTickCount())
{
if(GetPVarInt(playerid,"flood_dialog") > 4)
{
Kickle(playerid,"Dialog Hack");
return 0;
}
SetPVarInt(playerid,"flood_dialog",GetPVarInt(play erid,"flood_dialog")+1);
}else
{
SetPVarInt(playerid,"flood_dialog",0);
SetPVarInt(playerid, "AntiFloodDialogMagNeteC", GetTickCount()+300);
}
return 1;
}
hook OnPlayerStateChange(playerid, newstate, oldstate)
{
if(GetPVarInt(playerid,"AntiFloodRSpawnMagNeteC") > GetTickCount())
{
if(GetPVarInt(playerid,"flood_rspawn") > 4)
{
Kickle(playerid,"Car Hack");
return 0;
}
SetPVarInt(playerid,"flood_rspawn",GetPVarInt(play erid,"flood_rspawn")+1);
}else
{
SetPVarInt(playerid,"flood_rspawn",0);
SetPVarInt(playerid, "AntiFloodRSpawnMagNeteC", GetTickCount()+300);
}
return 1;
}
hook OnPlayerRequestSpawn(playerid)
{
if(GetPVarInt(playerid,"AntiFloodRSpawnMagNeteC") > GetTickCount())
{
if(GetPVarInt(playerid,"flood_rspawn") > 3)
{
Kickle(playerid,"Hack");
return 0;
}
SetPVarInt(playerid,"flood_rspawn",GetPVarInt(play erid,"flood_rspawn")+1);
}else
{
SetPVarInt(playerid,"flood_rspawn",0);
SetPVarInt(playerid, "AntiFloodRSpawnMagNeteC", GetTickCount()+300);
}
return 1;
}
hook OnPlayerCommandText(playerid, cmdtext[])
{
if(GetPVarInt(playerid,"AntiFloodCommandMagNeteC") > GetTickCount())
{
if(GetPVarInt(playerid,"flood_cmd") > 3)
{
Kickle(playerid,"Coomand Flood");
return 0;
}
SetPVarInt(playerid,"flood_cmd",GetPVarInt(playeri d,"flood_cmd")+1);
}else
{
SetPVarInt(playerid,"flood_cmd",0);
SetPVarInt(playerid, "AntiFloodCommandMagNeteC", GetTickCount()+300);
}
return 0;
}
hook OnPlayerText(playerid, text[])
{
if(GetPVarInt(playerid,"AntiFloodTextMagNeteC") > GetTickCount())
{
if(GetPVarInt(playerid,"flood_text") > 3)
{
Kickle(playerid,"Text Flood");
return 0;
}
SetPVarInt(playerid,"flood_text",GetPVarInt(player id,"flood_text")+1);
}else
{
SetPVarInt(playerid,"flood_text",0);
SetPVarInt(playerid, "AntiFloodTextMagNeteC", GetTickCount()+300);
}
return 0;
}
hook OnPlayerSpawn(playerid)
{
if(GetPVarInt(playerid,"AntiFloodSpawnMagNeteC") > GetTickCount())
{
if(GetPVarInt(playerid,"flood_spawn") > 3)
{
Kickle(playerid,"Spawn Flood");
return 1;
}
SetPVarInt(playerid,"flood_spawn",GetPVarInt(playe rid,"flood_spawn")+1);
}else
{
SetPVarInt(playerid,"flood_spawn",0);
SetPVarInt(playerid, "AntiFloodSpawnMagNeteC", GetTickCount()+300);
}
return 1;
}
hook OnPlayerConnect(playerid)
{
if(PVG->Int->connected[playerid] == 1)return Ban(playerid);
if(!strcmp(getName(playerid),"con",true) || strfind(getName(playerid),"_con",true) != -1 || strfind(getName(playerid),"con_",true) != -1)
{
Kick(playerid);
}
static mag_anti_ip[16],diger_ip[16],ip_count=0;
GetPlayerIp(playerid,mag_anti_ip,16);
foreach(new i:Player)
{
if(i !=playerid)
{
GetPlayerIp(i,diger_ip,16);
if(!strcmp(mag_anti_ip,diger_ip,true))ip_count++;
}
}
if(ip_count >= 5)Kick(playerid);
return 1;
}
hook OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID && playerid == killerid)return Kickle(playerid,"Death Hack");
if(GetPVarInt(playerid,"AntiFloodKillMagNeteC") > GetTickCount())
{
if(GetPVarInt(playerid,"flood_kill") > 3)
{
Kickle(playerid,"Fake Kill");
return 1;
}
SetPVarInt(playerid,"flood_kill",GetPVarInt(player id,"flood_kill")+1);
}else
{
SetPVarInt(playerid,"flood_kill",0);
SetPVarInt(playerid, "AntiFloodKillMagNeteC", GetTickCount()+300);
}
return 1;
}
hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_FIRE && !IsPlayerInAnyVehicle(playerid))
{
new playersWeapon = GetPlayerWeapon(playerid);
if(playersWeapon && playersWeapon != 40 && playersWeapon != 46)
{
new variableName[20];
format(variableName, sizeof(variableName), "PlayerWeapon%d", WeaponSlots[playersWeapon]);
if(GetPVarInt(playerid, variableName) != playersWeapon)
{
SetPVarInt(playerid,"suphe5",GetPVarInt(playerid," suphe5")+1);
ResetPlayerWeapons(playerid);
}
}
}
return 1;
}
public OnVehicleMod(playerid,vehicleid,componentid)
{
new vehicleide = GetVehicleModel(vehicleid);
new modok = islegalcarmod(vehicleide, componentid);
if (!modok || GetPlayerInterior(playerid) == 0)
{
RemoveVehicleComponent(vehicleid,componentid);
Banla(playerid, "Mod Hack!");// anti crash
return 0;
}
return 1;
}
|