[HELP NEEDED] Command makes the server crash.
#1

pawn Код:
else if(strcmp(x_nr,"get", true) == 0)
            {
                if(PlayerInfo[playerid][pPcarmodel1] != 999 || PlayerInfo[playerid][pPcarmodel2] != 999)
                {
                    new carlist1 = PlayerInfo[playerid][pPcarmodel1];
                    new carlist2 = PlayerInfo[playerid][pPcarmodel2];
                    new carcolor11 = PlayerInfo[playerid][pPcarcolor11];
                    new carcolor12 = PlayerInfo[playerid][pPcarcolor12];
                    new carcolor21 = PlayerInfo[playerid][pPcarcolor21];
                    new carcolor22 = PlayerInfo[playerid][pPcarcolor22];
                    new string2[128];
                    if(PlayerInfo[playerid][pVcarout] == 0)
                    {
                        tmp = strtok(cmdtext, idx);
                        if(!strlen(tmp) || strcmp(tmp,"list", true) == 0)
                        {
                            SendClientMessage(playerid, COLOR_YELLOW, "Available cars :");
                            SendClientMessage(playerid, COLOR_YELLOW, "-------------------------------------------------------------------");
                            if (carlist1 != 999) {format(string2, sizeof(string2), "Slot 1 :: %d - Color : ID %d and ID %d || /v get 1", carlist1, carcolor11, carcolor12); SendClientMessage(playerid, COLOR_YELLOW, string2);}
                            else {SendClientMessage(playerid, COLOR_YELLOW, "Slot 1 :: Empty");}
                            if (carlist2 != 999) {format(string2, sizeof(string2), "Slot 2 :: %d - Color : ID %d and ID %d || /v get 2", carlist2, carcolor21, carcolor22); SendClientMessage(playerid, COLOR_YELLOW, string2);}
                            else {SendClientMessage(playerid, COLOR_YELLOW, "Slot 2 :: Empty");}
                            SendClientMessage(playerid, COLOR_YELLOW, "-------------------------------------------------------------------"); return 1;
                        }
                        else if (strcmp(tmp,"1", true) == 0)
                        {
                            if(PlayerInfo[playerid][pPcarmodel1] != 999 && PlayerInfo[playerid][pVcarout] == 0)
                            {
                                new Float:x, Float:y, Float:z, Float:a;
                                x = PlayerInfo[playerid][pVlocx1];
                                y = PlayerInfo[playerid][pVlocy1];
                                z = PlayerInfo[playerid][pVlocz1];
                                a = PlayerInfo[playerid][pVangle1];
                                CreateVehicle(carlist1, x,y,z,a,carcolor11,carcolor12, 90000);
                                SetPlayerCheckpoint(playerid,x,y,z,5.0);
                                PlayerInfo[playerid][pVcarout] = 1;
                                SendClientMessage(playerid, COLOR_YELLOW, "Vehicle %s spawned at parking location. Look at your map to find the parking place.");
                                new car = 68;
                                for(new h = car; h < sizeof(CarInfo); h++)
                                {
                                    if(GetVehicleModel(h) != 0)
                                    {
                                        car = h + 1;
                                    }
                                }
                                PlayerInfo[playerid][pPcarkey] = car;
                                return 1;
                            }
                            else if(PlayerInfo[playerid][pPcarmodel2] == 999) {SendClientMessage(playerid, COLOR_GREY,  "You don't have any car at slot 1."); return 1;}
                            else if(PlayerInfo[playerid][pVcarout] != 0) {SendClientMessage(playerid, COLOR_NICERED, "You still have a car spawned. Park your car first to spawn another one.");}
                        }

                        else if (strcmp(tmp,"2", true) == 0)
                        {
                            if(PlayerInfo[playerid][pPcarmodel2] != 999 && PlayerInfo[playerid][pVcarout] == 0)
                            {
                                new Float:x, Float:y, Float:z, Float:a;
                                x = PlayerInfo[playerid][pVlocx2];
                                y = PlayerInfo[playerid][pVlocy2];
                                z = PlayerInfo[playerid][pVlocz2];
                                a = PlayerInfo[playerid][pVangle2];
                                CreateVehicle(carlist2, x,y,z,a,carcolor21,carcolor22, 90000);
                                SetPlayerCheckpoint(playerid,x,y,z,5.0);
                                PlayerInfo[playerid][pVcarout] = 2;
                                SendClientMessage(playerid, COLOR_YELLOW, "Vehicle %s spawned at parking location. Look at your map to find the parking place.");
                                new car = 68;
                                for(new h = car; h < sizeof(CarInfo); h++)
                                {
                                    if(GetVehicleModel(h) != 0)
                                    {
                                        car = h + 1;
                                    }
                                }
                                PlayerInfo[playerid][pPcarkey] = car;
                                return 1;
                            }
                            else if(PlayerInfo[playerid][pPcarmodel2] == 999){SendClientMessage(playerid, COLOR_GREY,  "You don't have any car at slot 2."); return 1;}
                            else if(PlayerInfo[playerid][pVcarout] != 0) {SendClientMessage(playerid, COLOR_NICERED, "You still have a car spawned. Park your car first to spawn another one.");}
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_YELLOW, "Available cars :");
                        SendClientMessage(playerid, COLOR_YELLOW, "-------------------------------------------------------------------");
                        if (carlist1 != 999) {format(string2, sizeof(string2), "Slot 1 :: %d - Color : ID %d and ID %d || /v get 1", carlist1, carcolor11, carcolor12); SendClientMessage(playerid, COLOR_YELLOW, string2);}
                        else {SendClientMessage(playerid, COLOR_YELLOW, "Slot 1 :: Empty");}
                        if (carlist2 != 999) {format(string2, sizeof(string2), "Slot 2 :: %d - Color : ID %d and ID %d || /v get 2", carlist2, carcolor21, carcolor22); SendClientMessage(playerid, COLOR_YELLOW, string2);}
                        else {SendClientMessage(playerid, COLOR_YELLOW, "Slot 2 :: Empty");}
                        SendClientMessage(playerid, COLOR_YELLOW, "-------------------------------------------------------------------");
                        SendClientMessage(playerid, COLOR_NICERED, "You still have a car spawned. Park your car first to spawn another one."); return 1;
                    }
                }
                else if(PlayerInfo[playerid][pPcarmodel1] != 999 && PlayerInfo[playerid][pPcarmodel2] != 999) {SendClientMessage(playerid, COLOR_GREY, "You don't have any car!"); return 1;}
            }
Somehow the code made the server crashed. Couldn't find what I've done wrong, so, help?
Oh, and I made this on Cuervo's Raven Roleplay. Some like [pPcarmodel1] and others were added by myself.
Pawno showed no errors, but as stated above, the server crashed whenever I tried to do /v get 1


Thanks in advance.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)