22.05.2015, 09:44
Hello,
I have a problem with infinite loops. Where do you think is the cause of infinite loop here:
and
I have a problem with infinite loops. Where do you think is the cause of infinite loop here:
PHP код:
public SpeedoUpdate()
{
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
new Float:x, Float:y, Float:z, Float:hp, string[24], vehicleid = GetPlayerVehicleID(i);
if(Speedo[i] == 0)
{
TextDrawShowForPlayer(i, vspeed[i]);
if(GetVehicleModel(vehicleid) != 509 && GetVehicleModel(vehicleid) != 481 && GetVehicleModel(vehicleid) != 510)
{
TextDrawShowForPlayer(i, vhealth[i]);
}
}
GetVehicleVelocity(vehicleid, x, y, z);
GetVehicleHealth(vehicleid, hp);
if(Kmhmph[i] == 0)
{
format(string, sizeof(string), "Speed: %dkm/h", floatround(floatsqroot(((x*x)+(y*y))+(z*z))*180.666667));
TextDrawSetString(vspeed[i], string);
TextDrawBackgroundColor(vspeed[i], 369098796);
TextDrawFont(vspeed[i], 2);
TextDrawLetterSize(vspeed[i], 0.349999, 1.299996);
TextDrawColor(vspeed[i], 0xC3C3C3FF);
TextDrawSetOutline(vspeed[i], 1);
TextDrawSetProportional(vspeed[i], 1);
}
if(Kmhmph[i] == 1)
{
format(string, sizeof(string), "Speed: %dm/s", floatround(floatsqroot(((x*x)+(y*y))+(z*z))*86.666667));
TextDrawSetString(vspeed[i], string);
TextDrawBackgroundColor(vspeed[i], 369098796);
TextDrawFont(vspeed[i], 2);
TextDrawLetterSize(vspeed[i], 0.349999, 1.299996);
TextDrawColor(vspeed[i], 0xC3C3C3FF);
TextDrawSetOutline(vspeed[i], 1);
TextDrawSetProportional(vspeed[i], 1);
}
format(string, sizeof(string), "Health: %d", floatround(hp));
TextDrawSetString(vhealth[i], string);
TextDrawBackgroundColor(vhealth[i], 369098796);
TextDrawFont(vhealth[i], 2);
TextDrawLetterSize(vhealth[i], 0.349999, 1.299996);
TextDrawColor(vhealth[i], 0xC3C3C3FF);
TextDrawSetOutline(vhealth[i], 1);
TextDrawSetProportional(vhealth[i], 1);
if(Speedo[i] == 1)
{
TextDrawHideForPlayer(i, vspeed[i]);
TextDrawHideForPlayer(i, vhealth[i]);
}
}
if(!IsPlayerInAnyVehicle(i))
{
TextDrawHideForPlayer(i, vspeed[i]);
TextDrawHideForPlayer(i, vhealth[i]);
}
}
}
PHP код:
public Production()
{
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(IsPlayerConnected(i))
{
if(pusedrug[i] == 1) {
SetPlayerArmedWeapon(i, 9);
SetPlayerWeather(i, 19); }
if(pusedrug[i] == 2) {
SetPlayerArmedWeapon(i, 9);
SetPlayerWeather(i, -74); }
if(pusedrug[i] == 3) {
SetPlayerArmedWeapon(i, 9);
SetPlayerWeather(i, 9); }
if(pusedrug[i] == 4) {
SetPlayerArmedWeapon(i, 9);
SetPlayerWeather(i, -130); }
}
}
}