SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 30/04/2018, 03:52 PM   #1
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 394
Reputation: 2
Default Neon system

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.

Code:
    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);
        }
Code:
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;
}
Code:
stock GetFile(vehicleid)
{
    new file[256];
    format(file, sizeof(file), "Neon/%d.ini", vehicleid);
    return file;
}
__________________
~POLAND~
KamilPolska is offline   Reply With Quote
Old 01/05/2018, 04:18 AM   #2
CyNiC
High-roller
 
Join Date: Jan 2009
Location: Brazil
Posts: 1,410
Reputation: 203
Default Re: Neon system

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.
__________________
My scripts
Brazucas'Server
CyNiC is offline   Reply With Quote
Old 01/05/2018, 03:14 PM   #3
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 394
Reputation: 2
Default Re: Neon system

How can I save / load the neon ID?
__________________
~POLAND~
KamilPolska is offline   Reply With Quote
Old 01/05/2018, 05:48 PM   #4
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 394
Reputation: 2
Default Re: Neon system

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
__________________
~POLAND~
KamilPolska is offline   Reply With Quote
Old 01/05/2018, 08:36 PM   #5
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 394
Reputation: 2
Default Re: Neon system

How it's working? For example, buying a red neon you have to use it?
Code:
dini_Create (file);
Car[playerid][neon_ID] = dini_IntSet (file, "Neon", 18647);

To get it charged I have to use it?
Code:
if(Car[playerid][neon_ID] == 18647)
{
              //CODE NEON
	return 1;
}
__________________
~POLAND~
KamilPolska is offline   Reply With Quote
Old 01/05/2018, 09:08 PM   #6
jasperschellekens
Gangsta
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Gehenna
Posts: 770
Reputation: 62
Default Re: Neon system

Read the rules dude, no double posting allowed. use the edit button
__________________
Coming soon:

Undead Wasteland Roleplay - Heavily mapped desert zombie apocalypse roleplay
Discord
jasperschellekens is offline   Reply With Quote
Old 02/05/2018, 03:04 PM   #7
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 394
Reputation: 2
Default Re: Neon system

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
__________________
~POLAND~
KamilPolska is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [T-Turbo + NEON] Trollerz Turbo system with NEON! Trollerz Filterscripts 5 10/09/2015 05:54 PM
I need help with neon system Ryan_Michael Scripting Help 1 01/07/2012 03:27 AM
Neon system Tamao_Serizawa Scripting Help 3 10/01/2012 05:30 PM
Neon System MuhammadFajar Scripting Help 3 09/09/2011 09:24 AM


All times are GMT. The time now is 10:20 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.