How can i do this?
#1

I am making a vehicle tuning shop for my server.
And my question is how to make a /neon command,which will toggle the neon on and off,i mean it will destroy the neon objects and then re-create them and re-attach them when the player types the cmd again.I can't seem to figure this out,because for every color the SetPVarInt is with a different name and the object IDs are different.Can anyone help me out?

Here is the tuning shop dialog:

pawn Код:
else if(dialogid == 30) //tune shop menu
    {
        if(response)
        {
            switch(listitem)
            {
                case 0: // Red neon
                {
                    SetPVarInt(playerid, "Status", 1);
                    SetPVarInt(playerid, "neon2", CreateObject(18647,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon3", CreateObject(18647,0,0,0,0,0,0));
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon2"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon3"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, 0xFFFFFFAA, "Red neon installed.");
                    GiveZaiatMoney(playerid, -500);
                    vehNeon[playerid] = 1;
                }
                case 1: // Blue neon
                {
                    SetPVarInt(playerid, "Status", 1);
                    SetPVarInt(playerid, "neon", CreateObject(18648,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon1", CreateObject(18648,0,0,0,0,0,0));
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, 0xFFFFFFAA, "Blue neon installed.");
                    GiveZaiatMoney(playerid, -500);
                    vehNeon[playerid] = 1;
                }
                case 2: // Green neon
                {
                    SetPVarInt(playerid, "Status", 1);
                    SetPVarInt(playerid, "neon4", CreateObject(18649,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon5", CreateObject(18649,0,0,0,0,0,0));
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon4"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon5"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, 0xFFFFFFAA, "Green neon installed.");
                    GiveZaiatMoney(playerid, -500);
                    vehNeon[playerid] = 1;
                }
                case 3: // White neon
                {
                    SetPVarInt(playerid, "Status", 1);
                    SetPVarInt(playerid, "neon6", CreateObject(18652,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon7", CreateObject(18652,0,0,0,0,0,0));
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon6"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon7"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, 0xFFFFFFAA, "White neon installed.");
                    GiveZaiatMoney(playerid, -500);
                    vehNeon[playerid] = 1;
                }
                case 4: // Pink neon
                {
                    SetPVarInt(playerid, "Status", 1);
                    SetPVarInt(playerid, "neon8", CreateObject(18651,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon9", CreateObject(18651,0,0,0,0,0,0));
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon8"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon9"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, 0xFFFFFFAA, "Pink neon installed.");
                    GiveZaiatMoney(playerid, -500);
                    vehNeon[playerid] = 1;
                }
                case 5: // Yellow neon
                {
                    SetPVarInt(playerid, "Status", 1);
                    SetPVarInt(playerid, "neon10", CreateObject(18650,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon11", CreateObject(18650,0,0,0,0,0,0));
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon10"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    AttachObjectToVehicle(GetPVarInt(playerid, "neon11"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, 0xFFFFFFAA, "Yellow neon installed.");
                    GiveZaiatMoney(playerid, -500);
                    vehNeon[playerid] = 1;
                }
                case 6: //remove neon
                {
                    DestroyObject(GetPVarInt(playerid, "neon"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon1"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon2"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon3"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon4"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon5"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon6"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon7"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon8"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon9"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon10"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon11"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon12"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "neon13"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "interior"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "interior1"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "back"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "back1"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "front"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "front1"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "undercover"));
                    DeletePVar(playerid, "Status");
                    DestroyObject(GetPVarInt(playerid, "undercover1"));
                    DeletePVar(playerid, "Status");
                    SendClientMessage(playerid, 0xFFFFFFAA, "Neon removed.");
                    GiveZaiatMoney(playerid, -1000);
                    vehNeon[playerid] = 0;
                }
            }
        }
    }
Can anyone give me an idea how to start,what to look for?
Reply
#2

bump
Reply
#3

can someone help?
Reply
#4

were all ignoring this topic because you bumped it three times today
Reply
#5

Stop bumping and read the forum rules. :/

By the way, you have to choise a command processor(strcmp/zcmd/ycmd/dcmd/rcmd), there are a lot, than make the command to display this dialog. Read some tutorials on how to make commands, and wikipedia to learn how to use dialogs.


Copy pasting codes looks to be the easier way to start scripting, but it isn't.
Reply
#6

Make a global variable
pawn Код:
new neon[MAX_PLAYERS][MAX_VEHICLES];//To store object id
new bool:HasNeaon[MAX_PLAYERS][MAX_VEHICLES]; // To check if he have neon
Now, when player typr /neon check if he has neon.
If he dont
pawn Код:
neon[playerid][vehicleid] = CreateObject..
//and attach
If they already have it,
pawn Код:
DestroyObject(neon[playerid][vehicleid]
Just an example.
Reply
#7

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
Stop bumping and read the forum rules. :/

By the way, you have to choise a command processor(strcmp/zcmd/ycmd/dcmd/rcmd), there are a lot, than make the command to display this dialog. Read some tutorials on how to make commands, and wikipedia to learn how to use dialogs.


Copy pasting codes looks to be the easier way to start scripting, but it isn't.
Aha ok cool i know how to "show" the dialog i am asking how to affect different parts of it,read before you hate.

I've bumped it once last night and once today as no one is helping out so yeah stupid reason to ignore
Reply
#8

Quote:
Originally Posted by Penki4a
Посмотреть сообщение
Aha ok cool i know how to "show" the dialog i am asking how to affect different parts of it,read before you hate.

I've bumped it once last night and once today as no one is helping out so yeah stupid reason to ignore
You have to wait 48 hours to bump.. :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)