new PlateCar1[256], Text3D:PlateUpCar1[MAX_VEHICLES]; new PlateCar2[256], Text3D:PlateUpCar2[MAX_VEHICLES]; new PlateCar3[256], Text3D:PlateUpCar3[MAX_VEHICLES]; new PlateCar4[256], Text3D:PlateUpCar4[MAX_VEHICLES]; #define DialogPlate1 3364 #define DialogPlate2 3365 #define DialogPlate3 3366 new TextCar[256], Text3D:TextUpCar[MAX_VEHICLES]; new OffTextCar[256], Text3D:OffTextUpCar[MAX_VEHICLES];
if (PlayerInfo[playerid][pPcarkey] != -1) { new vehicleid1 = PlayerInfo[playerid][pPcarkey]; SetVehicleVirtualWorld(PlayerInfo[playerid][pPcarkey], 255); Delete3DTextLabel(TextUpCar[CarInfo[vehicleid1][cLicense]]); } if (PlayerInfo[playerid][pPcarkey2] != -1) { new vehicleid2 = PlayerInfo[playerid][pPcarkey2]; SetVehicleVirtualWorld(PlayerInfo[playerid][pPcarkey2], 255); Delete3DTextLabel(TextUpCar[CarInfo[vehicleid2][cLicense]]); } if (PlayerInfo[playerid][pPcarkey3] != -1) { new vehicleid3 = PlayerInfo[playerid][pPcarkey3]; SetVehicleVirtualWorld(PlayerInfo[playerid][pPcarkey3], 255); Delete3DTextLabel(TextUpCar[CarInfo[vehicleid3][cLicense]]); }
if (PlayerInfo[playerid][pPcarkey] != -1) { new vehicleid = PlayerInfo[playerid][pPcarkey]; if(CarInfo[vehicleid][cPlate] >= 1) { format(OffTextCar, sizeof(OffTextCar), "%s", CarInfo[vehicleid][cLicense]); OffTextUpCar[vehicleid] = Create3DTextLabel(OffTextCar, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); Attach3DTextLabelToVehicle(Text3D:OffTextUpCar[vehicleid], vehicleid, 0.0, 0.0, 0.1); SetVehicleVirtualWorld(vehicleid, 0); } else { format(TextCar, sizeof(TextCar), "LS-666-BNZ", CarInfo[vehicleid][cLicense]); TextUpCar[vehicleid] = Create3DTextLabel(TextCar, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); Attach3DTextLabelToVehicle(Text3D:TextUpCar[vehicleid], vehicleid, 0.0, 0.0, 0.1); SetVehicleVirtualWorld(vehicleid, 0); } } if (PlayerInfo[playerid][pPcarkey2] != -1) { new vehicleid = PlayerInfo[playerid][pPcarkey2]; if(CarInfo[vehicleid][cPlate] >= 1) { format(OffTextCar, sizeof(OffTextCar), "%s", CarInfo[vehicleid][cLicense]); OffTextUpCar[vehicleid] = Create3DTextLabel(OffTextCar, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); Attach3DTextLabelToVehicle(Text3D:OffTextUpCar[vehicleid], vehicleid, 0.0, 0.0, 0.1); SetVehicleVirtualWorld(vehicleid, 0); } else { format(TextCar, sizeof(TextCar), "LS-666-BNZ", CarInfo[vehicleid][cLicense]); TextUpCar[vehicleid] = Create3DTextLabel(TextCar, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); Attach3DTextLabelToVehicle(Text3D:TextUpCar[vehicleid], vehicleid, 0.0, 0.0, 0.1); SetVehicleVirtualWorld(vehicleid, 0); } } if (PlayerInfo[playerid][pPcarkey3] != -1) { new vehicleid = PlayerInfo[playerid][pPcarkey3]; if(CarInfo[vehicleid][cPlate] >= 1) { format(OffTextCar, sizeof(OffTextCar), "%s", CarInfo[vehicleid][cLicense]); OffTextUpCar[vehicleid] = Create3DTextLabel(OffTextCar, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); Attach3DTextLabelToVehicle(Text3D:OffTextUpCar[vehicleid], vehicleid, 0.0, 0.0, 0.1); SetVehicleVirtualWorld(vehicleid, 0); } else { format(TextCar, sizeof(TextCar), "LS-666-BNZ", CarInfo[vehicleid][cLicense]); TextUpCar[vehicleid] = Create3DTextLabel(TextCar, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); Attach3DTextLabelToVehicle(Text3D:TextUpCar[vehicleid], vehicleid, 0.0, 0.0, 0.1); SetVehicleVirtualWorld(vehicleid, 0); } }
if(strcmp(x_nr,"plate",true) == 0) { GetPlayerMoney(playerid); if(PlayerInfo[playerid][pCash] < 15000) { SendClientMessage(playerid, COLOR_GREY, "You don't have enough moneys ."); return 1; } if(PlayerInfo[playerid][pPcarkey] == -1 && PlayerInfo[playerid][pPcarkey2] == -1 && PlayerInfo[playerid][pPcarkey3] == -1) { SendClientMessage(playerid, COLOR_GREY," You don't have a personal car ."); return 1; } new carid; if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { carid = PlayerInfo[playerid][pPcarkey]; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { carid = PlayerInfo[playerid][pPcarkey2]; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { carid = PlayerInfo[playerid][pPcarkey3]; } else { return 1; } if(IsPlayerInVehicle(playerid, carid)) { ShowPlayerDialog(playerid, DialogPlate1, DIALOG_STYLE_INPUT, "Inmatriculare", "Pune initialele orasului\nExemplu: LS", "Next","Close"); return 1; } else { SendClientMessage(playerid, COLOR_GREY, "You must be in a personal car."); } }
if(PlayerInfo[playerid][pPcarkey] != 1) { if(dialogid == DialogPlate1) { if(response) { new vehicleid = PlayerInfo[playerid][pPcarkey]; if(IsPlayerInVehicle(playerid, vehicleid)) { if(strlen(inputtext) < 3 && strlen(inputtext) > 0) { format(PlateCar1[0], sizeof(PlateCar1), "%s", inputtext); PlateCar1 = strtoupper(PlateCar1); PlateUpCar1[vehicleid] = Create3DTextLabel(PlateCar1, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); SetVehicleVirtualWorld(vehicleid, 0); ShowPlayerDialog(playerid, DialogPlate2, DIALOG_STYLE_INPUT, "Inmatriculari", "Alege maxim trei numere pe care le doresi\nExemplu : 666", "Next","Close"); } else { } } } } if(dialogid == DialogPlate2) { if(response) { new vehicleid = PlayerInfo[playerid][pPcarkey]; if(IsPlayerInVehicle(playerid, vehicleid)) { if(strlen(inputtext) == 2 || strlen(inputtext) == 3) { format(PlateCar2, sizeof(PlateCar2), "%s", inputtext); PlateUpCar2[vehicleid] = Create3DTextLabel(PlateCar2, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); SetVehicleVirtualWorld(vehicleid, 0); if(Numbers(inputtext)) return ShowPlayerDialog(playerid, DialogPlate3, DIALOG_STYLE_INPUT, "Inmatriculari", "Alege trei initiale pe care le vrei\nExemplu : CVL", "Done","Close"); else { } } else { } } } } if(dialogid == DialogPlate3) { if(response) { new vehicleid = PlayerInfo[playerid][pPcarkey]; new carid = GetPlayerVehicleID(playerid); if(IsPlayerInVehicle(playerid, vehicleid)) //if(Numbers(inputtext)) { return } { if(strlen(inputtext) == 3) { Delete3DTextLabel(TextUpCar[vehicleid]); format(PlateCar3, sizeof(PlateCar3), "%s", inputtext); PlateCar3 = strtoupper(PlateCar3); PlateUpCar3[vehicleid] = Create3DTextLabel(PlateCar3, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); format(PlateCar4, sizeof(PlateCar4), "%s-%s-%s", PlateCar1[0], PlateCar2, PlateCar3[0]); Delete3DTextLabel(Text3D:PlateUpCar4[vehicleid]); PlateUpCar4[vehicleid] = Create3DTextLabel(PlateCar4, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); SetVehicleToRespawn(vehicleid); Attach3DTextLabelToVehicle(Text3D:PlateUpCar4[vehicleid], vehicleid, 0.0, 0.0, 0.1); PutPlayerInVehicle(playerid, carid, 2); SetVehicleVirtualWorld(vehicleid, 0); CarInfo[vehicleid][cPlate] = 1; CarInfo[vehicleid][cLicense] = PlateCar4; GivePlayerMoney(playerid, -15000); SendClientMessage(playerid, COLOR_WHITE, "Ti-ai schimbat numarul de inmatriculare si ai platit {FF0000}$15.000 !"); SBizzInfo[13][sbTill] += 5000;//plate buisness ExtortionSBiz(13, 5000); OnCarUpdate(); } else { } } } } } if(PlayerInfo[playerid][pPcarkey2] != 1) { if(dialogid == DialogPlate1) { if(response) { new vehicleid = PlayerInfo[playerid][pPcarkey2]; if(IsPlayerInVehicle(playerid, vehicleid)) { format(PlateCar1, sizeof(PlateCar1), "%s", inputtext); PlateCar1 = strtoupper(PlateCar1); PlateUpCar1[vehicleid] = Create3DTextLabel(PlateCar1, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); SetVehicleVirtualWorld(vehicleid, 0); ShowPlayerDialog(playerid, DialogPlate2, DIALOG_STYLE_INPUT, "Inmatriculari", "Alege maxim trei numere pe care le doresi\nExemplu : 666", "Next","Close"); } } } if(dialogid == DialogPlate2) { if(response) { new vehicleid = PlayerInfo[playerid][pPcarkey2]; if(IsPlayerInVehicle(playerid, vehicleid)) { format(PlateCar2, sizeof(PlateCar2), "%s", inputtext); PlateUpCar2[vehicleid] = Create3DTextLabel(PlateCar2, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); SetVehicleVirtualWorld(vehicleid, 0); if(Numbers(inputtext)) return ShowPlayerDialog(playerid, DialogPlate3, DIALOG_STYLE_INPUT, "Inmatriculari", "Alege trei initiale pe care le vrei\nExemplu : CVL", "Done","Close"); else { } } } } if(dialogid == DialogPlate3) { if(response) { new vehicleid = PlayerInfo[playerid][pPcarkey2]; if(IsPlayerInVehicle(playerid, vehicleid)) { Delete3DTextLabel(TextUpCar[vehicleid]); format(PlateCar3, sizeof(PlateCar3), "%s", inputtext); PlateCar3 = strtoupper(PlateCar3); PlateUpCar3[vehicleid] = Create3DTextLabel(PlateCar3, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); format(PlateCar4, sizeof(PlateCar4), "%s-%s-%s", PlateCar1, PlateCar2, PlateCar3); Delete3DTextLabel(Text3D:PlateUpCar4[vehicleid]); PlateUpCar4[vehicleid] = Create3DTextLabel(PlateCar4, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); Delete3DTextLabel(Text3D:TextUpCar[vehicleid]); Attach3DTextLabelToVehicle(Text3D:PlateUpCar4[vehicleid], vehicleid, 0.0, 0.0, 0.1); SetVehicleToRespawn(vehicleid); SetVehicleVirtualWorld(vehicleid, 0); CarInfo[vehicleid][cPlate] = 1; CarInfo[vehicleid][cLicense] = PlateCar4; GivePlayerMoney(playerid, -15000); SendClientMessage(playerid, COLOR_WHITE, "Ti-ai schimbat numarul de inmatriculare si ai platit {FF0000}$15.000 !"); OnCarUpdate(); } } } } if(PlayerInfo[playerid][pPcarkey3] != 1) { if(dialogid == DialogPlate1) { if(response) { new vehicleid = PlayerInfo[playerid][pPcarkey3]; if(IsPlayerInVehicle(playerid, vehicleid)) { format(PlateCar1, sizeof(PlateCar1), "%s", inputtext); PlateCar1 = strtoupper(PlateCar1); PlateUpCar1[vehicleid] = Create3DTextLabel(PlateCar1, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); SetVehicleVirtualWorld(vehicleid, 0); ShowPlayerDialog(playerid, DialogPlate2, DIALOG_STYLE_INPUT, "Inmatriculari", "Alege maxim trei numere pe care le doresi\nExemplu : 666", "Next","Close"); } } } if(dialogid == DialogPlate2) { if(response) { new vehicleid = PlayerInfo[playerid][pPcarkey3]; if(IsPlayerInVehicle(playerid, vehicleid)) { format(PlateCar2, sizeof(PlateCar2), "%s", inputtext); PlateUpCar2[vehicleid] = Create3DTextLabel(PlateCar2, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); SetVehicleVirtualWorld(vehicleid, 0); if(Numbers(inputtext)) return ShowPlayerDialog(playerid, DialogPlate3, DIALOG_STYLE_INPUT, "Inmatriculari", "Alege trei initiale pe care le vrei\nExemplu : CVL", "Done","Close"); else { } } } } if(dialogid == DialogPlate3) { if(response) { new vehicleid = PlayerInfo[playerid][pPcarkey3]; if(IsPlayerInVehicle(playerid, vehicleid)) { Delete3DTextLabel(TextUpCar[vehicleid]); format(PlateCar3, sizeof(PlateCar3), "%s", inputtext); PlateCar3 = strtoupper(PlateCar3); PlateUpCar3[vehicleid] = Create3DTextLabel(PlateCar3, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); format(PlateCar4, sizeof(PlateCar4), "%s-%s-%s", PlateCar1, PlateCar2, PlateCar3); Delete3DTextLabel(Text3D:PlateUpCar4[vehicleid]); PlateUpCar4[vehicleid] = Create3DTextLabel(PlateCar4, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1); Delete3DTextLabel(Text3D:TextUpCar[vehicleid]); Attach3DTextLabelToVehicle(Text3D:PlateUpCar4[vehicleid], vehicleid, 0.0, 0.0, 0.1); SetVehicleToRespawn(vehicleid); SetVehicleVirtualWorld(vehicleid, 0); CarInfo[vehicleid][cPlate] = 1; CarInfo[vehicleid][cLicense] = PlateCar4; GivePlayerMoney(playerid, -15000); SendClientMessage(playerid, COLOR_WHITE, "Ti-ai schimbat numarul de inmatriculare si ai platit {FF0000}$15.000 !"); OnCarUpdate(); } } } }
cLicense[256], cPlate[14],
public OnCarUpdate() { new idx; new File: file2; idx = carsonserver; while (idx < sizeof(CarInfo)) { new coordsstring[256]; format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%d,%s\n", CarInfo[idx][cModel], CarInfo[idx][cLocationx], CarInfo[idx][cLocationy], CarInfo[idx][cLocationz], CarInfo[idx][cAngle], CarInfo[idx][cColorOne], CarInfo[idx][cColorTwo], CarInfo[idx][cOwner], CarInfo[idx][cDescription], CarInfo[idx][cOwned], CarInfo[idx][cLicense], CarInfo[idx][cPlate]); if(idx == carsonserver) { file2 = fopen("masini.cfg", io_write); } else { file2 = fopen("masini.cfg", io_append); } fwrite(file2, coordsstring); idx++; fclose(file2); } }
public LoadCar() { new arrCoords[12][64]; new strFromFile2[256]; new File: file = fopen("masini.cfg", io_read); if (file) { new idx = carsonserver; while (idx < sizeof(CarInfo)) { fread(file, strFromFile2); split(strFromFile2, arrCoords, ','); CarInfo[idx][cModel] = strval(arrCoords[0]); CarInfo[idx][cLocationx] = floatstr(arrCoords[1]); CarInfo[idx][cLocationy] = floatstr(arrCoords[2]); CarInfo[idx][cLocationz] = floatstr(arrCoords[3]); CarInfo[idx][cAngle] = floatstr(arrCoords[4]); CarInfo[idx][cColorOne] = strval(arrCoords[5]); CarInfo[idx][cColorTwo] = strval(arrCoords[6]); strmid(CarInfo[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255); strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255); CarInfo[idx][cOwned] = strval(arrCoords[9]); strmid(CarInfo[idx][cLicense], arrCoords[10], 0, strlen(arrCoords[10]), 255); CarInfo[idx][cPlate] = strval(arrCoords[11]); idx++; } for(new h = carsonserver; h < sizeof(CarInfo); h++) { AddStaticVehicleEx(CarInfo[h][cModel], CarInfo[h][cLocationx], CarInfo[h][cLocationy], CarInfo[h][cLocationz]+1.0, CarInfo[h][cAngle], CarInfo[h][cColorOne], CarInfo[h][cColorTwo], -1); SetVehicleVirtualWorld(h, 255); } } return 1; }
new debug[32];
format(debug,32,"Vehicleid: %d",vehicleid);
SendClientMessage(playerid,-1,debug);
Your code is horribly optimized, but try debugging your script. Start out trying to find out what ID 'vehicleid' and 'carid' actually returns.
pawn Код:
|