Server cloeses if i use this command
#1

when i use this command to try to buy a car the samp server closes down

Код:
	if(strcmp(cmd, "/buythiscar", true) == 0)
	        {
	            new car = 184;
	            new model = GetVehicleModel(idcar);
	            if(IsADealerShipVehicle(idcar))
	            {
			    	if(PlayerInfo[playerid][pPcarkey] == 999 || PlayerInfo[playerid][pPcarkey] == 999) { }
			    	else return SendClientMessage(playerid, COLOR_GREY,"* You already own a cars!");
					if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar))
					{
					    if(PlayerInfo[playerid][pCarLic] == 1)
					    {
					        for(new h = 184; h < sizeof(CarInfo); h++)
							{
								if(CarInfo[h][cOwned] == 1)
								{
								    car = h + 1;
								}
							}
							if(PlayerInfo[playerid][pPcarkey] != 999) { PlayerInfo[playerid][pPcarkey] = car; }
							else { PlayerInfo[playerid][pPcarkey] = car; }
							CarInfo[car][cOwned] = 1;
							strmid(CarInfo[car][cOwner], sendername, 0, strlen(sendername), 999);
							GivePlayerMoney(playerid,-GetVehiclePrice(idcar));
							CarInfo[car][cModel] = model;
							CarInfo[car][cVirWorld] = 0;
							GameTextForPlayer(playerid, "~w~Congratulations~n~Don't forget to /carpark it!", 5000, 3);
							SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");

							OnPropUpdate(4);
							OnPlayerDataSave(playerid);
						}
						else
						{
							SendClientMessage(playerid, COLOR_WHITE, "* The owner of the dealership didint let you buy a car because you dont have a drivers license!");
							return 1;
						}
					}
					else
					{
					    SendClientMessage(playerid, COLOR_GREY, "  You don't have enough cash with you ! ");
					    return 1;
					}
					return 0;
	            }
	        }
Reply
#2

does pawno give you any errors on compile?
Reply
#3

also check the " OnPropUpdate(); " function. also sry for double post.
Reply
#4

Probably an out-of-bounds error. What's the size of 'CarInfo'?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)