Neon system -
KamilPolska - 30.04.2018
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;
}
Re: Neon system -
CyNiC - 01.05.2018
Vehicle IDS in your case are random, so you cant handle it(as you tried in the code).
You must save / load the neon id and player vehicle model in his account. There are thousands of Dini tutorials out there.
Re: Neon system -
KamilPolska - 01.05.2018
How can I save / load the neon ID?
Re: Neon system -
KamilPolska - 01.05.2018
Someone will help me to add a neon ID. He wants the player not to have a neon after creating a private vehicle. He will have to buy a neon in the workshop and after purchasing he to save the neon and load it.
https://pastebin.com/LPiPJbpc
Re: Neon system -
KamilPolska - 01.05.2018
How it's working? For example, buying a red neon you have to use it?
Код:
dini_Create (file);
Car[playerid][neon_ID] = dini_IntSet (file, "Neon", 18647);
To get it charged I have to use it?
Код:
if(Car[playerid][neon_ID] == 18647)
{
//CODE NEON
return 1;
}
Re: Neon system -
jasperschellekens - 01.05.2018
Read the rules dude, no double posting allowed. use the edit button
Re: Neon system -
KamilPolska - 02.05.2018
Okay. "Neon = 18648" has been saved in the file. When I enter the command /loadneon I get the message "You do not have a neon.". Why?!
https://pastebin.com/RaBpKUPX