09.02.2018, 13:47
so i got OtherTimer() and Speedo() that are causing AMX BACKTRACE
these are the functions
PHP код:
[14:27:41] [debug] #0 00000000 in public OtherTimer () from serverteste.amx
[14:27:41] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[14:27:41] [debug] Stack pointer (STK) is 0x15354B4, heap pointer (HEA) is 0x1535548
[14:27:41] [debug] AMX backtrace:
[14:27:41] [debug] #0 00000000 in public Speedo () from serverteste.amx
[14:27:42] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[14:27:42] [debug] Stack pointer (STK) is 0x15354B4, heap pointer (HEA) is 0x1535548
[14:27:42] [debug] AMX backtrace:
PHP код:
function OtherTimer()
{
new str[128], string[128];
//new username[MAX_PLAYER_NAME];
foreach(Player, i)
{
/*if(IsPlayerConnected(i))
{
GetPlayerName(i,username,sizeof(username));
new Float:oldX[MAX_PLAYERS], Float:oldY[MAX_PLAYERS], Float:oldZ[MAX_PLAYERS];
oldX[i] = PosX[i];
oldY[i] = PosY[i];
oldZ[i] = PosZ[i];
GetPlayerPos(i,PosX[i],PosY[i],PosZ[i]);
new Float:distanta[MAX_PLAYERS];
distanta[i] = GetDistanceBetweenPoints(oldX[i],oldY[i],oldZ[i],PosX[i],PosY[i],PosZ[i]);
if((distanta[i] > 65.0) && (PlayerData[i][Admin] == 0)) // IsLoggedIn
{
//format(string,sizeof(string), "TeleportHack: Este posibil ca %s(id:%d)sa aibe teleport hack, distanta teleportata %f(puneti-va spec).",username,i,distanta[i]);
//ABroadCast(RED,string,1);
}
} */
if (PlayerToPoint(2.0, i, 2486.5198,-1645.2394,14.0772))
{
GameTextForPlayer(i, "~w~HQ Groove St. 125", 5000, 1);
}
if (PlayerToPoint(2.0, i, 1172.4932,-1323.3479,15.4030))
{
GameTextForPlayer(i, "~w~HQ Emergency Dept.", 5000, 1);
}
if (PlayerToPoint(2.0, i, 755.3737,-1362.3281,13.5131))
{
GameTextForPlayer(i, "~w~HQ SAN Network", 5000, 1);
}
if (PlayerToPoint(2.0, i, 1653.7765,-1655.5151,22.5156))
{
GameTextForPlayer(i, "~w~HQ SA Gov", 5000, 1);
}
if (PlayerToPoint(2.0, i, 1899.4996,-2005.1289,13.5469))
{
GameTextForPlayer(i, "~w~HQ Varrio Nuevo Estrada", 5000, 1);
}
if (PlayerToPoint(2.0, i, 2000.0482,-1114.3588,27.1250))
{
GameTextForPlayer(i, "~w~HQ Ballas", 5000, 1);
}
if(PlayerData[i][IsLoggedIn] == false && ByPASS[i] == 0)
{
if (AFKLoggin[i] != -1)
{
AFKLoggin[i] -= 1;
if(AFKLoggin[i] == 0)
{
SendClientMessage(i, COLOR_LIGHTRED, "** You haven't login in 40 seconds (Kicked) **");
KickEx(i);
}
}
}
if(PlayerData[i][Cash] != GetPlayerMoney(i))//
{
new hack = GetPlayerMoney(i) - PlayerData[i][Cash];
if(hack!=0)
{
ResetMoneyBar(i);
UpdateMoneyBar(i,PlayerData[i][Cash]);
}
}
new Float: oldX[MAX_PLAYERS], Float: oldY[MAX_PLAYERS], Float: oldZ[MAX_PLAYERS];
oldX[i] = PosX[i];
oldY[i] = PosY[i];
oldZ[i] = PosZ[i];
GetPlayerPos(i,PosX[i],PosY[i],PosZ[i]);
new Float:distanta[MAX_PLAYERS];
distanta[i] = GetDistanceBetweenPoints(oldX[i],oldY[i],oldZ[i],PosX[i],PosY[i],PosZ[i]);
if(distanta[i] == 0) PlayerAFK[i] = 1;
else PlayerAFK[i] = 0;
//new faction = PlayerData[i][Member] + PlayerData[i][Leader];
if(PlayerData[i][Muted] > 0)
{
if(PlayerData[i][MutedTime] > 0) PlayerData[i][MutedTime] -= 1;
if(PlayerData[i][MutedTime] <= 0)
{
PlayerData[i][MutedTime] = 0;
PlayerData[i][Muted] = 0;
mysql_format(SQL,str,128,"UPDATE `users` SET `Muted`='0', `MutedTime`='0' WHERE `id`='%d'", PlayerData[i][ID]);
mysql_tquery(SQL,str, "", "");
SendClientMessage(i, 0xFFFF00AA, "* Your time of silence has ended.");
format(string, 128, "Mute time has ended!");
GameTextForPlayer(i, string, 5000, 1);
}
}
if(PlayerData[i][PlayerCuffed] > 1)
{
PlayerData[i][PlayerCuffed] -= 1;
if(PlayerData[i][PlayerCuffed] == 0)
{
GameTextForPlayer(i, "~r~You broke the Cuffs, you are free!", 2500, 3);
TogglePlayerControllable(i, 1);
PlayerData[i][PlayerCuffed] = 0;
}
}
if(PlayerData[i][Jailed] == 1)
{
if(PlayerData[i][JailTime] > 0) PlayerData[i][JailTime] -= 1;
mysql_format(SQL,str,128,"UPDATE `users` SET `JailTime`='%d' WHERE `id`='%d'", PlayerData[i][JailTime], PlayerData[i][ID]);
mysql_tquery(SQL,str, "", "");
if(PlayerData[i][JailTime] <= 0)
{
PlayerData[i][JailTime] = 0;
PlayerData[i][Jailed] = 0;
mysql_format(SQL,str,128,"UPDATE `users` SET `Jailed`='0', `JailTime`='0' WHERE `id`='%d'", PlayerData[i][ID]);
mysql_tquery(SQL,str, "", "");
SpawnPlayer(i);
}
}
if(PlayerData[i][PlayerToFind] >= 0)
{
new id = PlayerData[i][PlayerToFind];
if(PlayerData[id][InBizz] == -1 && PlayerData[id][InHouse] == -1 && PlayerData[id][InHQ] == -1)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(id, X,Y,Z);
SetPlayerCheckpoint(i, X,Y,Z, 3);
}
else
{
if(PlayerData[id][InBizz] > -1)
{
new biz = PlayerData[id][InBizz];
SetPlayerCheckpoint(i, BizzInfo[biz][bEntranceX],BizzInfo[biz][bEntranceY],BizzInfo[biz][bEntranceZ], 3);
}
else if(PlayerData[id][InHouse] > -1)
{
new house = PlayerData[id][InHouse];
SetPlayerCheckpoint(i, HouseInfo[house][hEntrancex],HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez], 3);
}
else if(PlayerData[id][InHQ] == 2) { SetPlayerCheckpoint(i, 2486.5198,-1645.2394,14.0772, 3); }
else if(PlayerData[id][InHQ] == 3) { SetPlayerCheckpoint(i, 2000.0482,-1114.3588,27.1250, 3); }
else if(PlayerData[id][InHQ] == 4) { SetPlayerCheckpoint(i, 1899.4996,-2005.1289,13.5469, 3); }
else if(PlayerData[id][InHQ] == 5) { SetPlayerCheckpoint(i, 1653.7765,-1655.5151,22.5156, 3); }
else if(PlayerData[id][InHQ] == 6) { SetPlayerCheckpoint(i, 755.3737,-1362.3281,13.5131, 3); }
else if(PlayerData[id][InHQ] == 7) { SetPlayerCheckpoint(i, 1172.4932,-1323.3479,15.4030, 3); }
}
}
if(GetPlayerState(i) == PLAYER_STATE_DRIVER && PlayerData[i][Speedlimit])
{//Speedlimit
new a, b, c;
GetPlayerKeys(i, a, b ,c);
new speed = PlayerData[i][Speed];
if(a == 8 && speed > PlayerData[i][Speedlimit])
{
new newspeed = speed - PlayerData[i][Speedlimit];
ModifyVehicleSpeed(GetPlayerVehicleID(i), -newspeed);
}
}
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new speed=GetPlayerSpeed(i,0);
new string23[256],sendername[25];
GetPlayerName(i,sendername,sizeof(sendername));
if(speed>230)
{
format(string23, 256, "SpeedHack: %s(id:%d) conduce cu %.0d km/h folosind un %s(puneti-va spec).", sendername,i,speed,vehName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
ABroadCast(RED,string23,1);
}
}
if(GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsPlayerNPC(i))
{//Radar
if(PlayerData[i][RadarUse] > 0)
{
new Float:x1, Float:y1, Float:z1;
GetPlayerPos(i,x1,y1,z1);
foreach(Player, o)
{
if(o != i)
{
if(IsPlayerInRangeOfPoint(o, 20, x1,y1,z1))
{
new factiono = PlayerData[o][Member] + PlayerData[o][Leader];
new speed = PlayerData[o][Speed];
if(speed >= PlayerData[i][RadarUse] && GetPlayerState(o) == PLAYER_STATE_DRIVER)
{
if(factiono != 1 || PlayerData[o][OnDuty] == 0)
{
format(string, sizeof(string), "%s(%d) conduce cu %.0d km/h, Radar Limit: %d km/h!",PlayerData[o][Name],o,speed,PlayerData[i][RadarUse]);
SendClientMessage(i, COLOR_REDD, string);
format(string, sizeof(string), "Ai fost prins de radarul pus de %s(%d) cu o viteza de %.0d km/h, Limita Legala Radar: %d km/h! ,ai fost amendat cu 50.000 $",PlayerData[i][Name],i,speed,PlayerData[i][RadarUse]);
SendClientMessage(o, COLOR_REDD, string);
GivePlayerCash(o, -50000);
}
}
}
}
}
if(PlayerData[i][Speed] > 1)
{
PlayerData[i][RadarUse] = 0;
SendClientMessage(i, COLOR_LIGHTBLUE2, "You stopped your radar.");
}
}
}
if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK && PlayerData[i][Admin] < 1)
{
new reasonn[64];
format(reasonn,sizeof(reasonn),"Jetpack");
BanA(i,"AdmBot",reasonn,0,0,1);
}
}
}
PHP код:
function Speedo()
{
new str[128];
foreach(Player, i)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsPlayerNPC(i) && Allowed[i] == 0)
{
new Float: oldX[MAX_PLAYERS], Float: oldY[MAX_PLAYERS], Float: oldZ[MAX_PLAYERS];
oldX[i] = PosX[i];
oldY[i] = PosY[i];
oldZ[i] = PosZ[i];
GetPlayerPos(i,PosX[i],PosY[i],PosZ[i]);
new Float:distanta[MAX_PLAYERS];
distanta[i] = GetDistanceBetweenPoints(oldX[i],oldY[i],oldZ[i],PosX[i],PosY[i],PosZ[i]);
new str1[128];
new vehicle = GetPlayerVehicleID(i);
new oldspeed = PlayerData[i][Speed];
PlayerData[i][Speed] = GetVehicleSpeed(GetPlayerVehicleID(i), 0);
new newspeed = PlayerData[i][Speed];
new acceleration = abs(newspeed - oldspeed);
new Consume = (((acceleration / 10) + 1) * (newspeed / 20));
new Float:Consume2 = float(Consume);
new carid = FindSpawnID(vehicle);
if(!(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle)))
{
Gas[vehicle] -= Consume2/500;
if(Gas[vehicle] <= 0)
{
new e,l,a,d,b,bo,o;
GetVehicleParamsEx(vehicle,e,l,a,d,b,bo,o);
SetVehicleParamsEx(vehicle,0,l,a,d,b,bo,o);
format(str1,sizeof(str1),"Fuel: ~r~NO FUEL"); //
PlayerTextDrawSetString(i, Fuell, str1);
Gas[vehicle] = 0;
}
}
else
{
Consume = 0;
}
if(CarInfo[carid][cID] != -2 && carid != 0) PlayerTextDrawHide(i, Odometerr);
PlayerTextDrawHide(i, Speedd);
PlayerTextDrawHide(i, Fuell);
PlayerTextDrawHide(i, Destination);
PlayerTextDrawHide(i, DestinationKM);
//PlayerTextDrawHide(i, Radio);
CarInfo[carid][KM] += distanta[i]/1000;
mysql_format(SQL, str,128,"UPDATE `cars` SET `KM`='%f' WHERE `ID`='%d' LIMIT 1",CarInfo[carid][KM],carid);
mysql_tquery(SQL, str, "", "");
if(CarInfo[carid][cID] != -2 && carid != 0)
{
format(str1,sizeof(str1),"Odometer: ~y~%.2f ~w~KM",CarInfo[carid][KM]);
PlayerTextDrawSetString(i, Odometerr, str1);
}
if(PlayerData[i][Speed] <= 110)
{
format(str1,sizeof(str1),"Speed: ~y~%d ~w~KM/H",PlayerData[i][Speed]);
PlayerTextDrawSetString(i, Speedd, str1);
}
if(PlayerData[i][Speed] > 110 && PlayerData[i][Speed] <= 160)
{
format(str1,sizeof(str1),"Speed: ~b~%d ~w~KM/H",PlayerData[i][Speed]);
PlayerTextDrawSetString(i, Speedd, str1);
}
if(PlayerData[i][Speed] > 160)
{
format(str1,sizeof(str1),"Speed: ~r~%d ~w~KM/H",PlayerData[i][Speed]);
PlayerTextDrawSetString(i, Speedd, str1);
}
if(Gas[vehicle] > 0)
{
format(str1,sizeof(str1),"Fuel: %d %%", floatround(Gas[vehicle], floatround_round)); //
//format(str1,sizeof(str1),"Fuel: %d %% (C: %d %%)", floatround(Gas[vehicle], floatround_round), Consume); //
PlayerTextDrawSetString(i, Fuell, str1);
}
if(DestinationSet[i] == 0)
{
format(str1,sizeof(str1),"Destination: "); //
PlayerTextDrawSetString(i, Destination, str1);
}
else
{
/*GetPlayer3DZone2(DestSet[i][0],DestSet[i][1],DestSet[i][2],zone,30);
format(str1,sizeof(str1),"Destination: ~y~%s",zone); //
PlayerTextDrawSetString(i, Destination, str1); */
new Float:distance = GetPlayerDistanceFromPoint(i, DestSet[i][0],DestSet[i][1],DestSet[i][2]);
format(str1,sizeof(str1),"Destination: ~y~%.2f ",distance); //
PlayerTextDrawSetString(i, DestinationKM, str1);
PlayerTextDrawShow(i, DestinationKM);
}
/* if(RadioSet[i] == 0)
{
format(str1,sizeof(str1),"Radio: ~r~OFF"); //
PlayerTextDrawSetString(i, Radio, str1);
}
else
{
format(str1,sizeof(str1),"Radio: ~y~%s",RadioName(RadioSet[i])); //
PlayerTextDrawSetString(i, Radio, str1);
}*/
if(CarInfo[carid][cID] != -2 && carid != 0) PlayerTextDrawShow(i, Odometerr);
PlayerTextDrawShow(i, Speedd);
PlayerTextDrawShow(i, Fuell);
PlayerTextDrawShow(i, Destination);
//PlayerTextDrawShow(i, Radio);
}
else
{
PlayerTextDrawHide(i, Odometerr);
PlayerTextDrawHide(i, Speedd);
PlayerTextDrawHide(i, Fuell);
PlayerTextDrawHide(i, Destination);
// PlayerTextDrawHide(i, Radio);
PlayerTextDrawHide(i, DestinationKM);
}
}
}