30.04.2018, 14:52
I would like to make a neon garage system. I do not know how to load and save the neon on objects in the file to my private vehicle.
Код:
if(dini_Int(GetFile(vehicleid),"HaveNeon") == 1) { if(dini_Int(GetFile(vehicleid),"ColorNeon") == 1) { neon1[vehicleid] = CreateObject(18648,0.0,0.0,0.0,0.0,0.0,0.0); neon2[vehicleid] = CreateObject(18648,0.0,0.0,0.0,0.0,0.0,0.0); AttachObjectToVehicle(neon1[vehicleid],vehicleid,-0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(neon2[vehicleid],vehicleid ,0.8, 0.0, -0.70, 0.0, 0.0, 0.0); } else if(dini_Int(GetFile(vehicleid),"ColorNeon") == 2) { DestroyObject(neon1[vehicleid]); DestroyObject(neon2[vehicleid]); neon1[vehicleid] = CreateObject(18647,0.0,0.0,0.0,0.0,0.0,0.0); neon2[vehicleid] = CreateObject(18647,0.0,0.0,0.0,0.0,0.0,0.0); AttachObjectToVehicle(neon1[vehicleid],vehicleid,-0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(neon2[vehicleid],vehicleid,0.8, 0.0, -0.70, 0.0, 0.0, 0.0); }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1995) { if(!response) return 1; switch(listitem) { case 0: { PlayerPlaySound(playerid,1056,0.0,0.0,0.0); if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 111, DIALOG_STYLE_MSGBOX, "{FF0000} Warning!", "{99FFFF}You are not in a vehicle", "Continue", "Cancel"); if(GetPlayerMoney(playerid) < 100) return ShowPlayerDialog(playerid, 112, DIALOG_STYLE_MSGBOX, "{FF0000} Warning!", "{99FFFF} You dont have enough money", "Continue", "Cancel"); if(dini_Int(GetFile(GetPlayerVehicleID(playerid)),"HaveNeon") == 1) return ShowPlayerDialog(playerid, 113, DIALOG_STYLE_MSGBOX, "{FF0000} Warning!", "{99FFFF} There is neon in this vehicle", "Continue", "Cancel"); dini_IntSet(GetFile(GetPlayerVehicleID(playerid)),"ColorNeon",1); dini_IntSet(GetFile(GetPlayerVehicleID(playerid)),"HaveNeon",1); GivePlayerMoney(playerid,-100); neon1[GetPlayerVehicleID(playerid)] = CreateObject(18648,0.0,0.0,0.0,0.0,0.0,0.0); neon2[GetPlayerVehicleID(playerid)] = CreateObject(18648,0.0,0.0,0.0,0.0,0.0,0.0); AttachObjectToVehicle(neon1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(neon2[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.8, 0.0, -0.70, 0.0, 0.0, 0.0); SendClientMessage(playerid,0xFFFFFAA,"{99FFFF} • You Bought neon to your vehicle"); } case 1: { PlayerPlaySound(playerid,1056,0.0,0.0,0.0); if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 111, DIALOG_STYLE_MSGBOX, "{FF0000} Warning!", "{99FFFF} You are not in a vehicle", "Continue", "Cancel"); if(GetPlayerMoney(playerid) < 100) return ShowPlayerDialog(playerid, 112, DIALOG_STYLE_MSGBOX, "{FF0000} Warning!", "{99FFFF} You dont have enough money", "Continue", "Cancel"); if(dini_Int(GetFile(GetPlayerVehicleID(playerid)),"HaveNeon") == 1) return ShowPlayerDialog(playerid, 113, DIALOG_STYLE_MSGBOX, "Warning!", "{99FFFF} There is neon in this vehicle", "Continue", "Cancel"); dini_IntSet(GetFile(GetPlayerVehicleID(playerid)),"ColorNeon",2); dini_IntSet(GetFile(GetPlayerVehicleID(playerid)),"HaveNeon",1); GivePlayerMoney(playerid,-100); neon1[GetPlayerVehicleID(playerid)] = CreateObject(18647,0.0,0.0,0.0,0.0,0.0,0.0); neon2[GetPlayerVehicleID(playerid)] = CreateObject(18647,0.0,0.0,0.0,0.0,0.0,0.0); AttachObjectToVehicle(neon1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(neon2[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.8, 0.0, -0.70, 0.0, 0.0, 0.0); SendClientMessage(playerid,0xFFFFFAA,"{99FFFF} • You Bought neon to your vehicle"); } } } return 1; }
Код:
stock GetFile(vehicleid) { new file[256]; format(file, sizeof(file), "Neon/%d.ini", vehicleid); return file; }