The console stops after selling a car
#1

So, this is the problem.

Everytime when a player sell a car to the other player, the Samp-server.exe console closes itself.
It closes when a player did /accept car. Please help me to fix the problem
/sellmycar
Code:
CMD:sellmycar(playerid, params[])
{
    for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
	{
        if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId]))
 		{
            new Float:health;
            GetVehicleHealth(PlayerVehicleInfo[playerid][d][pvId], health);
   			new string[128], giveplayerid, price;
			if(sscanf(params, "ud", giveplayerid, price)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /sellmycar [playerid] [price] PERINGATAN : kalau sell 100 berarti $100 perak");
            if(price < 1) return SendClientMessageEx(playerid, COLOR_GREY, "Price must be higher than 0 .");
            if(playerid == giveplayerid)
			{
                SendClientMessageEx(playerid, COLOR_GREY, "You can not use this command on yourself.");
                return 1;
            }
            if(!IsPlayerConnected(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "Player is currently not connected to the server.");
            if (ProxDetectorS(8.0, playerid, giveplayerid))
		 	{
                VehicleOffer[giveplayerid] = playerid;
                VehicleId[giveplayerid] = d;
                VehiclePrice[giveplayerid] = price;
                format(string, sizeof(string), "* You offered %s to buy this %s for $%d.", GetPlayerNameEx(giveplayerid), GetVehicleName(PlayerVehicleInfo[playerid][d][pvId]), price);
                SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
                format(string, sizeof(string), "* %s has offered you their %s for $%d, (type /accept car) to buy.", GetPlayerNameEx(playerid), GetVehicleName(PlayerVehicleInfo[playerid][d][pvId]), price);
                SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
                return 1;
            }
            else
			{
                SendClientMessageEx(playerid, COLOR_GREY, "That player is not near you.");
                return 1;
            }
        }
    }
    SendClientMessageEx(playerid, COLOR_GREY, " You need to be inside a vehicle that you own.");
    return 1;
}
/accept car
Code:
CMD:accept(playerid, params[])
{
	new string[512];
	new String[512];
	new sendername[MAX_PLAYER_NAME];
	new giveplayer[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid)) {
        if(isnull(params)) {
            SendClientMessageEx(playerid, COLOR_WHITE, "[USAGE] /accept [name]");
            SendClientMessageEx(playerid, COLOR_GREY, "Available names: Sex, Mats, Crack, Pot, Weapon, Craft, Repair, Job, Live, Refill, Fix, Upengine, Hyd, spray, paintjob");
            SendClientMessageEx(playerid, COLOR_GREY, "Available names: Faction, Family, Taxi, Bus, Boxing, Mechanic, Ticket, Car, Supcall, Death, Ws, Work, Nos, Body");
            return 1;
        }
               if(strcmp(params,"car",true) == 0) {
			if(VehicleOffer[playerid] < 999) {
				if(IsPlayerConnected(VehicleOffer[playerid])) {
					if(GetPlayerCash(playerid) > VehiclePrice[playerid]) {
						if(IsPlayerInVehicle(VehicleOffer[playerid], PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId])) {
							if(!ProxDetectorS(8.0, VehicleOffer[playerid], playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You are not near the car dealer");
							new playervehicleid = GetPlayerFreeVehicleId(playerid);
							new carsamount = GetPlayerVehicleCount(playerid);
							if(PlayerInfo[playerid][pDonateRank] == 0 && carsamount >= 3) return SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars.");
							if(PlayerInfo[playerid][pDonateRank] == 2 && carsamount >= 4) return SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars.");
							if(PlayerInfo[playerid][pDonateRank] == 3 && carsamount >= 5) return SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars.");
							if(PlayerInfo[playerid][pDonateRank] == 4 && carsamount >= 5) return SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars.");
							if(playervehicleid == -1) return SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars.");
							new ip[32], ipex[32];
							GetPlayerIp(playerid, ip, sizeof(ip));
							GetPlayerIp(VehicleOffer[playerid], ipex, sizeof(ipex));
							format(String, sizeof(String), "[CAR] %s (IP: %s) has paid %s to %s for the %s (IP: %s)", GetPlayerName(playerid), ip, FormatMoney(VehiclePrice[playerid]), GetPlayerNameEx(VehicleOffer[playerid]), GetVehicleName(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId]), ipex);
							Log("logs/pay.log", String);
							GetPlayerName(VehicleOffer[playerid], giveplayer, sizeof(giveplayer));
							GetPlayerName(playerid, sendername, sizeof(sendername));
							format(String, sizeof(String), "* You bought the %s for %s, from %s. (Check /carhelp for more help)", GetVehicleName(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId]), FormatMoney(VehiclePrice[playerid]),giveplayer);
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, String);
							format(String, sizeof(String), "* You sold your %s to %s for %s.",GetVehicleName(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId]), sendername,FormatMoney(VehiclePrice[playerid]));
							SendClientMessageEx(VehicleOffer[playerid], COLOR_LIGHTBLUE, String);
							GivePlayerCash( VehicleOffer[playerid], VehiclePrice[playerid] );
							GivePlayerCash(playerid, -VehiclePrice[playerid]);
							RemovePlayerFromVehicle(VehicleOffer[playerid]);
							new Float:slx, Float:sly, Float:slz;
							GetPlayerPos(VehicleOffer[playerid], slx, sly, slz);
							SetPlayerPos(VehicleOffer[playerid], slx, sly, slz+2);
                            PlayerVehicleInfo[playerid][playervehicleid][pvId] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId];
                            PlayerVehicleInfo[playerid][playervehicleid][pvModelId] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvModelId];
                            PlayerVehicleInfo[playerid][playervehicleid][pvPosX] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosX];
                            PlayerVehicleInfo[playerid][playervehicleid][pvPosY] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosY];
                            PlayerVehicleInfo[playerid][playervehicleid][pvPosZ] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosZ];
                            PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosAngle];
                            PlayerVehicleInfo[playerid][playervehicleid][pvLock] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvLock];
                            PlayerVehicleInfo[playerid][playervehicleid][pvLocked] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvLocked];
                            PlayerVehicleInfo[playerid][playervehicleid][pvPaintJob] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPaintJob];
                            PlayerVehicleInfo[playerid][playervehicleid][pvColor1] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvColor1];
                            PlayerVehicleInfo[playerid][playervehicleid][pvColor2] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvColor2];
                            strmid(PlayerVehicleInfo[playerid][playervehicleid][pvAllowPlayer], PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvAllowPlayer], 0, strlen(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvAllowPlayer]), 255);
                            PlayerVehicleInfo[playerid][playervehicleid][pvAllowedPlayerId] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvAllowedPlayerId];
                            PlayerVehicleInfo[playerid][playervehicleid][pvPark] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPark];
                            PlayerVehicleInfo[playerid][playervehicleid][pvInsurances] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvInsurances];
                            for(new m = 0; m < MAX_MODS; m++) {
                                PlayerVehicleInfo[playerid][playervehicleid][pvMods][m] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvMods][m];
                            }
                            for(new vt = 0; vt < MAX_OBJECTS_PER_PLAYER; vt++) {
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyID][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyID][vt];
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyPosX][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyPosX][vt];
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyPosY][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyPosY][vt];
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyPosZ][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyPosZ][vt];
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyRotX][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyRotX][vt];
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyRotY][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyRotY][vt];
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyRotZ][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyRotZ][vt];
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyColor][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyColor][vt];
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyIndex][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyIndex][vt];
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyTexture1][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTexture1][vt];
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyTexture2][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTexture2][vt];
                                PlayerVehicleInfo[playerid][playervehicleid][pvToyTextureID][vt] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextureID][vt];
							    if(vt == 0)
							    {
									format(PlayerVehicleInfo[playerid][playervehicleid][pvToyText1], 128, "%s", PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText1]);
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextCol1] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol1];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextSize1] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize1];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextID1] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID1];
								}
							    if(vt == 1)
							    {
									format(PlayerVehicleInfo[playerid][playervehicleid][pvToyText2], 128, "%s", PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText2]);
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextCol2] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol2];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextSize2] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize2];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextID2] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID2];
								}
							    if(vt == 2)
							    {
									format(PlayerVehicleInfo[playerid][playervehicleid][pvToyText3], 128, "%s", PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText3]);
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextCol3] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol3];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextSize3] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize3];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextID3] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID3];
								}
							    if(vt == 3)
							    {
									format(PlayerVehicleInfo[playerid][playervehicleid][pvToyText4], 128, "%s", PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText4]);
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextCol4] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol4];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextSize4] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize4];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextID4] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID4];
								}
							    if(vt == 4)
							    {
									format(PlayerVehicleInfo[playerid][playervehicleid][pvToyText5], 128, "%s", PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText5]);
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextCol5] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol5];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextSize5] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize5];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextID5] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID5];
								}
							    if(vt == 5)
							    {
									format(PlayerVehicleInfo[playerid][playervehicleid][pvToyText6], 128, "%s", PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText6]);
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextCol6] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol6];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextSize6] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize6];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextID6] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID6];
								}
							    if(vt == 6)
							    {
									format(PlayerVehicleInfo[playerid][playervehicleid][pvToyText7], 128, "%s", PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText7]);
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextCol7] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol7];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextSize7] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize7];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextID7] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID7];
								}
							    if(vt == 7)
							    {
									format(PlayerVehicleInfo[playerid][playervehicleid][pvToyText8], 128, "%s", PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText8]);
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextCol8] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol8];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextSize8] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize8];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextID8] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID8];
								}
							    if(vt == 8)
							    {
									format(PlayerVehicleInfo[playerid][playervehicleid][pvToyText9], 128, "%s", PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText9]);
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextCol9] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol9];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextSize9] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize9];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextID9] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID9];
								}
							    if(vt == 9)
							    {
									format(PlayerVehicleInfo[playerid][playervehicleid][pvToyText10], 128, "%s", PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText10]);
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextCol10] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol10];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextSize10] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize10];
									PlayerVehicleInfo[playerid][playervehicleid][pvToyTextID10] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID10];
								}
							}
							PlayerVehicleInfo[playerid][playervehicleid][pvNeon] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvNeon];
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId] = 0;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvModelId] = 0;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosX] = 0.0;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosY] = 0.0;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosZ] = 0.0;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosAngle] = 0.0;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvLock] = 3;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvLocked] = 0;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPaintJob] = -1;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvColor1] = 0;
							PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvImpounded] = 0;
							PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvStored] = 0;
							PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvDestroyed] = 0;
							PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvStored] = 0;
							PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvDestroyed] = 0;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvColor2] = 0;
                            strmid(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvAllowPlayer], "No-one", 0, strlen("No-one"), 255);
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvAllowedPlayerId] = INVALID_PLAYER_ID;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPark] = 0;
                            PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvInsurances] = 0;
                            for(new m = 0; m < MAX_MODS; m++) {
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvMods][m] = 0;
                            }
                            for(new vt = 0; vt < MAX_OBJECTS_PER_PLAYER; vt++) {
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyID][vt] = 0;
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyPosX][vt] = 0.0;
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyPosY][vt] = 0.0;
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyPosZ][vt] = 0.0;
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyRotX][vt] = 0.0;
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyRotY][vt] = 0.0;
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyRotZ][vt] = 0.0;
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyColor][vt] = 1;
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyIndex][vt] = 0;
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTexture1][vt] = 0;
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTexture2][vt] = 0;
                                PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextureID][vt] = 0;
							    if(vt == 0)
							    {
									format(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText1], 128, "None");
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol1] = 1;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize1] = 20;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID1] = 0;
								}
							    if(vt == 1)
							    {
									format(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText2], 128, "None");
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol2] = 1;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize2] = 20;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID2] = 0;
								}
							    if(vt == 2)
							    {
									format(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText3], 128, "None");
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol3] = 1;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize3] = 20;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID3] = 0;
								}
							    if(vt == 3)
							    {
									format(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText4], 128, "None");
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol4] = 1;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize4] = 20;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID4] = 0;
								}
							    if(vt == 4)
							    {
									format(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText5], 128, "None");
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol5] = 1;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize5] = 20;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID5] = 0;
								}
							    if(vt == 5)
							    {
									format(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText6], 128, "None");
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol6] = 1;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize6] = 20;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID6] = 0;
								}
							    if(vt == 6)
							    {
									format(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText7], 128, "None");
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol7] = 1;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize7] = 20;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID7] = 0;
								}
							    if(vt == 7)
							    {
									format(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText8], 128, "None");
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol8] = 1;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize8] = 20;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID8] = 0;
								}
							    if(vt == 8)
							    {
									format(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText9], 128, "None");
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol9] = 1;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize9] = 20;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID9] = 0;
								}
							    if(vt == 9)
							    {
									format(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyText10], 128, "None");
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextCol10] = 1;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextSize10] = 20;
									PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvToyTextID10] = 0;
								}
							}
							PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvNeon] = 0;
                            VehicleOffer[playerid] = 999;
                            VehiclePrice[playerid] = 0;
                            return 1;
                        }
                        else {
                            SendClientMessageEx(playerid, COLOR_GREY, "   The Car Dealer is not in the offered car!");
                            return 1;
                        }
                    }
                    else {
                        SendClientMessageEx(playerid, COLOR_GREY, "   You can't afford the car!");
                        return 1;
                    }
                }
                return 1;
            }
            else {
                SendClientMessageEx(playerid, COLOR_GREY, "   Nobody offered to buy a car!");
                return 1;
            }
        }
// Then blah blah blah more another codes
Reply
#2

There's a lot going on in the accept command. To make debugging a little easier, you might want to use the CrashDetect (GitHub Repo) plugin. This will most likely give a more detailed picture of what's going on. When your server crashes it will print information to the server_log.txt.

I do notice some logging going on
PHP Code:
Log("logs/pay.log"String); 
My assumption is that this function will write things to a file. If the server cannot access/create that file or directory, it might crash. So you might want to verify that the 'logs' folder exists (probably in scriptfiles). If it doesn't exist, create it, and check whether the problem still exists.
Reply
#3

Found the problem, there are multiple "if(strcmp(params,"car",true) == 0) {" in my script.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)