/getpizza shuting the my server
#1

Hello guys.
When i try to use /getpizza commant it's shut-down my server.
the code:
pawn Код:
CMD:getpizza(playerid, params[]) {
    if(PlayerInfo[playerid][pJob] != 21 && PlayerInfo[playerid][pJob2] != 21) {
        SendClientMessageEx(playerid,COLOR_GREY,"   You are not a Pizza Boy!");
    }
    else if(!IsAPizzaCar(GetPlayerVehicleID(playerid))) {
        SendClientMessageEx(playerid,COLOR_GREY,"   You need to be driving a pizzaboy found at the side of the Pizza Stack!");
    }
    else if(GetPlayerSkin(playerid) != 155) {
        SendClientMessageEx(playerid,COLOR_GREY,"   You need to be in the Pizza Stack uniform!");
    }
    else if(GetPVarType(playerid, "Pizza")) {
        SendClientMessageEx(playerid, COLOR_GREY, "   You are already delivering pizzas!");
    }
    else if(!IsPlayerInRangeOfPoint(playerid, 3.0, -1713.961425, 1348.545166, 7.180452)) {
        SendClientMessageEx(playerid,COLOR_GREY,"   You are not at the Pizza Stack pickup!");
    }
    else {

        new rand = random(MAX_HOUSES - 1);
        while(!(HouseInfo[rand][hOwned] && HouseInfo[rand][hExteriorZ] <= 100 && HouseInfo[rand][hExteriorX] > -2802.389648 && HouseInfo[rand][hExteriorX] < -1400.710327 && HouseInfo[rand][hExteriorY] < 2800 && HouseInfo[rand][hExteriorY] > -216.298019)) {
            if(++rand >= MAX_HOUSES) {
                rand = 0;
            }
        }

        new
            iDist = floatround(GetPlayerDistanceFromPoint(playerid, HouseInfo[rand][hExteriorX], HouseInfo[rand][hExteriorY], HouseInfo[rand][hExteriorZ])),
            szMessage[86];

        SetPVarInt(playerid, "tpPizzaTimer", iDist / 80);
        SetPVarInt(playerid, "pizzaTotal", iDist / 10);
        SetPVarInt(playerid, "pizzaTimer", iDist / 10);
        SetPVarInt(playerid, "Pizza", rand);

        SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPPIZZARUNTIMER);
        SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_PIZZATIMER);

        format(szMessage, sizeof(szMessage), "You have picked up a pizza for %s. You have %d seconds to deliver it!", HouseInfo[rand][hOwner], iDist / 10);
        SendClientMessageEx(playerid, COLOR_WHITE, szMessage);

        SetPlayerCheckpoint(playerid, HouseInfo[rand][hExteriorX], HouseInfo[rand][hExteriorY], HouseInfo[rand][hExteriorZ], 5);
    }
    return 1;
}
what to do?
Reply
#2

i'm fairly certain this part:

Quote:

while(!(HouseInfo[rand][hOwned] && HouseInfo[rand][hExteriorZ] <= 100 && HouseInfo[rand][hExteriorX] > -2802.389648 && HouseInfo[rand][hExteriorX] < -1400.710327 && HouseInfo[rand][hExteriorY] < 2800 && HouseInfo[rand][hExteriorY] > -216.298019)) {
if(++rand >= MAX_HOUSES) {
rand = 0;
}
}

is angering your server
Reply
#3

Quote:
Originally Posted by kaisersouse
Посмотреть сообщение
i'm fairly certain this part:



is angering your server
So i need to delete this part?
Reply
#4

I wouldnt say that. I would try and make that a more efficient loop.

For testing however, comment it out, recompile and restart the server. See if it goes tits-up when you use the command. If not...it was that loop.
Reply
#5

Quote:
Originally Posted by kaisersouse
Посмотреть сообщение
I wouldnt say that. I would try and make that a more efficient loop.

For testing however, comment it out, recompile and restart the server. See if it goes tits-up when you use the command. If not...it was that loop.
I try to restart not working.
can you show me for expmple to better loop?
Reply
#6

Quote:
Originally Posted by kaisersouse
Посмотреть сообщение
I wouldnt say that. I would try and make that a more efficient loop.

For testing however, comment it out, recompile and restart the server. See if it goes tits-up when you use the command. If not...it was that loop.
Sorry for double post but can you show me exmple to a better loop?
Reply
#7

Try to search it yourself.
A better example for better loop using is foreach.
Its more efficient and faster than the normal loop.
Reply
#8

Quote:
Originally Posted by Romel
Посмотреть сообщение
Try to search it yourself.
A better example for better loop using is foreach.
Its more efficient and faster than the normal loop.
And do you think that the the loop make the restart?
Reply
#9

Quote:
Originally Posted by Romel
Посмотреть сообщение
Try to search it yourself.
A better example for better loop using is foreach.
Its more efficient and faster than the normal loop.
Agin sorry for double but if i will do more efficient loop the restart wond happend?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)