30.12.2013, 20:27
Hackers which can crash players ,so the player got yellow screen samp stuck then they got crash out of game how to prevent that is there are any fs or a code??
stock IsPointInMapBounds(Float:x, Float:y, Float:z)//credits to Southclaw, just modifyed it a lil' bit
{
return ((-20000.0 <= x <= 20000.0) & (-20000.0 <= y <= 20000.0) & (-20000.0 <= z <= 20000.0)) ? 1 : 0;
}
//ya, i know that i didn't care about the player driving a car or not,
//just modify it im too lazy right now :P
#include <a_samp>//Credits to the SA-MP Team
#include <YSI\y_timers>//Credits to ******
new Float:tmpwP[MAX_PLAYERS][13];
new tmpwC[MAX_PLAYERS];
main()
{
printf("Bounds checker has been loaded!\nWill store 3 temp. positions. one every 5 seconds.");
}
ptask boundsCH[5000](playerid)
{
switch(tmpwC[playerid])
{
case 0:GetPlayerPos(playerid, tmpwP[playerid][0], tmpwP[playerid][1], tmpwP[playerid][2]);
case 1:GetPlayerPos(playerid, tmpwP[playerid][3], tmpwP[playerid][4], tmpwP[playerid][5]);
case 2:GetPlayerPos(playerid, tmpwP[playerid][6], tmpwP[playerid][7], tmpwP[playerid][8]), tmpwC[playerid] = -1;
}
tmpwC[playerid]++;
GetPlayerPos(playerid,tmpwP[playerid][9], tmpwP[playerid][10], tmpwP[playerid][11]);
if(!IsPointInMapBounds(tmpwP[playerid][9], tmpwP[playerid][10], tmpwP[playerid][11]))
{
SendClientMessage(playerid,-1,"You've been teleported outside the world! Tell the staff members about this.");
if(IsPointInMapBounds(tmpwP[playerid][0], tmpwP[playerid][1], tmpwP[playerid][2]))
SetPlayerPos(playerid,tmpwP[playerid][0], tmpwP[playerid][1], tmpwP[playerid][2]);
else if(IsPointInMapBounds(tmpwP[playerid][3], tmpwP[playerid][4], tmpwP[playerid][5]))
SetPlayerPos(playerid,tmpwP[playerid][3], tmpwP[playerid][4], tmpwP[playerid][5]);
else if(IsPointInMapBounds(tmpwP[playerid][6], tmpwP[playerid][7], tmpwP[playerid][8]))
SetPlayerPos(playerid,tmpwP[playerid][6], tmpwP[playerid][7], tmpwP[playerid][8]);
else SetPlayerPos(playerid,0,0,4.5);//if none of the points were within the worlds boundaries, port the players somewhere
}
}
stock IsPointInMapBounds(Float:x, Float:y, Float:z)//Credits to Southclaw, just optimized it a lil' bit
{
return ((-20000.0 <= x <= 20000.0) & (-20000.0 <= y <= 20000.0) & (-20000.0 <= z <= 20000.0)) ? 1 : 0;
}