Server lockup? this peice of code "sometimes" locks up the server
#1

ok, i dont really get why this locks up the server but, sometimes it works perfectly, sometimes it just locks up the server..
pawn Код:
SendClientMessageFormatted(playerid, RED, "Player: %s(%d) Hit vehicleid: %d With Objectid: %d - Missileid: %d", Playername(playerid), playerid, v, objectid, missileid);
            printf("Player: %s(%d) Hit vehicleid: %d With Objectid: %d - Missileid: %d", Playername(playerid), playerid, v, objectid, missileid);
            Wait(250);
            DestroyDynamicObject(Vehicle_Smoke[id][0]);
            Vehicle_Firing_Missile[id] = 0;
            KillTimer(Update_Missile_Timer[playerid]);
            KillTimer(Missile_Explode_Timer[playerid]);
            SendClientMessageFormatted(playerid, RED, "2Player: %s(%d) Hit vehicleid: %d With Objectid: %d - Missileid: %d", Playername(playerid), playerid, v, objectid, missileid);
pawn Код:
stock Wait(time)
{
    new stamp = tickcount();
    while (tickcount() - stamp < time){}
    return 1;
}
Note: no, it hasn't been over 24 hours.
Note: id = GetPlayerVehicleID(playerid) - Yes, the player is in a vehicle
Note: v = the vehicle that the missile hit.
Reply
#2

Quote:
Originally Posted by Donya
Посмотреть сообщение
ok, i dont really get why this locks up the server but, sometimes it works perfectly, sometimes it just locks up the server..
pawn Код:
SendClientMessageFormatted(playerid, RED, "Player: %s(%d) Hit vehicleid: %d With Objectid: %d - Missileid: %d", Playername(playerid), playerid, v, objectid, missileid);
            printf("Player: %s(%d) Hit vehicleid: %d With Objectid: %d - Missileid: %d", Playername(playerid), playerid, v, objectid, missileid);
            Wait(250);
            DestroyDynamicObject(Vehicle_Smoke[id][0]);
            Vehicle_Firing_Missile[id] = 0;
            KillTimer(Update_Missile_Timer[playerid]);
            KillTimer(Missile_Explode_Timer[playerid]);
            SendClientMessageFormatted(playerid, RED, "2Player: %s(%d) Hit vehicleid: %d With Objectid: %d - Missileid: %d", Playername(playerid), playerid, v, objectid, missileid);
pawn Код:
stock Wait(time)
{
    new stamp = tickcount();
    while (tickcount() - stamp < time){}
    return 1;
}
Note: no, it hasn't been over 24 hours.
Note: id = GetPlayerVehicleID(playerid) - Yes, the player is in a vehicle
Note: v = the vehicle that the missile hit.
I have no idea where did you get that ridiculous function (although it was on wiki earlier, called Halt() I guess), but it just makes the whole server freeze for amount of time you use.
There is no function that could "pause" your code execution for amount of time without "pausing" all the server.
Reply
#3

exactly, thats the point of it. since samp does not have a full range of createexplosion types, i used objects. so it will wait 250 ms to destroy the object..

ok, i will j8ust use createexplosion and then set there vehicle health back, then remove the vehicle health i wanna remove.

thanks, also that function has never given me problems before ;\

instead of using a timer, is there anyother thing that wont stop the server?
Reply
#4

LOL, I have an identic function called "Sleep", but ****** says that function hangs the entire server.... Look the thread called "SetTimer's not working" by Biesmen on page 2 Y_Les got very angry with that function XD

EDIT: Too late .. XD ****** posted this 10 seconds before me
Reply
#5

no, i use it for my basketball script, tested it on 10 players, 5 vs 5 on a court, i used it to make a player do the basketball jump animation then wait, then move the ball object.

also instead of using a timer, is there any other thing that wont stop the server?
Reply
#6

whats so bad about using a timer?
Reply
#7

i guess i don't want a lot of publics'.. it seems to be my only solution then
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)