[HELP] Tuned Car Spawning Menu
#1

I have made menu witch spawns tuned cars, but it's not working... when i select car from menu, menu closes, shows message "enjoy your ride'' , but car is not spawned...

here is a part of menu:

Код:
if(CurrentMenu3 == TunedVehicles)
	{
		switch(row)
		{
	 case 0:
	    {
	    TogglePlayerControllable(playerid, 1);
     	if (GetPlayerMoney(playerid) >= 0)
		  {
		  if(IsPlayerInAnyVehicle(playerid))
		  {
		  TogglePlayerControllable(playerid, 0);
		  ShowMenuForPlayer(TunedVehicles,playerid);
	    SendClientMessage(playerid, COLOR_RED, "You are already in car.");
		  return 1;
		  }
		  else
		  {
	    TogglePlayerControllable(playerid, 1);
	    GivePlayerMoney(playerid, -0);
	 		CreateVehicle (562, x, y, z + 2.0, a + 90.0, -1, -1, 5000);
			LinkVehicleToInterior(PlayerVehI[playerid], GetPlayerInterior(playerid));
    	ChangeVehiclePaintjob(PlayerVehI[playerid],random(2)+1);
		  AddVehicleComponent(PlayerVehI[playerid],1037);
		  AddVehicleComponent(PlayerVehI[playerid],1010);
		  AddVehicleComponent(PlayerVehI[playerid],1035);
		  AddVehicleComponent(PlayerVehI[playerid],1039);
		  AddVehicleComponent(PlayerVehI[playerid],1041);
		  AddVehicleComponent(PlayerVehI[playerid],1086);
		  AddVehicleComponent(PlayerVehI[playerid],1087);
		  AddVehicleComponent(PlayerVehI[playerid],1147);
		  AddVehicleComponent(PlayerVehI[playerid],1148);
		  AddVehicleComponent(PlayerVehI[playerid],1172);
			SendClientMessage(playerid, COLOR_GREEN, "You selected a tuned Elegy");
		  }
			}
			else
			{
			TogglePlayerControllable(playerid, 0);
			ShowMenuForPlayer(TunedVehicles,playerid);
			
			return 1;
			}}
what could be wrong?
Reply
#2

http://ampaste.net/m1f0c36f

Try that
Reply
#3

It helps to have good indentation , I saw a few bracket errors within the code, might fix it.

pawn Код:
if(CurrentMenu3 == TunedVehicles)
{
    switch(row)
    {
        case 0:
        {
            TogglePlayerControllable(playerid, 1);
            if (GetPlayerMoney(playerid) >= 0)
            {
                if(IsPlayerInAnyVehicle(playerid))
                {
                    TogglePlayerControllable(playerid, 0);
                    ShowMenuForPlayer(TunedVehicles,playerid);
                    SendClientMessage(playerid, COLOR_RED, "You are already in car.");
                    return 1;
                }
                else
                {
                    TogglePlayerControllable(playerid, 1);
                    GivePlayerMoney(playerid, -0);
                    CreateVehicle (562, x, y, z + 2.0, a + 90.0, -1, -1, 5000);
                    LinkVehicleToInterior(PlayerVehI[playerid], GetPlayerInterior(playerid));
                    ChangeVehiclePaintjob(PlayerVehI[playerid],random(2)+1);
                    AddVehicleComponent(PlayerVehI[playerid],1037);
                    AddVehicleComponent(PlayerVehI[playerid],1010);
                    AddVehicleComponent(PlayerVehI[playerid],1035);
                    AddVehicleComponent(PlayerVehI[playerid],1039);
                    AddVehicleComponent(PlayerVehI[playerid],1041);
                    AddVehicleComponent(PlayerVehI[playerid],1086);
                    AddVehicleComponent(PlayerVehI[playerid],1087);
                    AddVehicleComponent(PlayerVehI[playerid],1147);
                    AddVehicleComponent(PlayerVehI[playerid],1148);
                    AddVehicleComponent(PlayerVehI[playerid],1172);
                    SendClientMessage(playerid, COLOR_GREEN, "You selected a tuned Elegy");
                }
            }
        }
    }
    else
    {
        TogglePlayerControllable(playerid, 0);
        ShowMenuForPlayer(TunedVehicles,playerid);
        return 1;
    }
}
Reply
#4

in my gm i have 0 errors :/

EDIT: with codes what you gave me, i can't even compile.... :/
Reply
#5

Quote:
Originally Posted by ǝɹoɯ‾ʎ
It helps to have good indentation , I saw a few bracket errors within the code, might fix it.

pawn Код:
if(CurrentMenu3 == TunedVehicles)
{
    switch(row)
    {
        case 0:
        {
            TogglePlayerControllable(playerid, 1);
            if (GetPlayerMoney(playerid) >= 0)
            {
                if(IsPlayerInAnyVehicle(playerid))
                {
                    TogglePlayerControllable(playerid, 0);
                    ShowMenuForPlayer(TunedVehicles,playerid);
                    SendClientMessage(playerid, COLOR_RED, "You are already in car.");
                    return 1;
                }
                else
                {
                    TogglePlayerControllable(playerid, 1);
                    GivePlayerMoney(playerid, -0);
                    CreateVehicle (562, x, y, z + 2.0, a + 90.0, -1, -1, 5000);
                    LinkVehicleToInterior(PlayerVehI[playerid], GetPlayerInterior(playerid));
                    ChangeVehiclePaintjob(PlayerVehI[playerid],random(2)+1);
                    AddVehicleComponent(PlayerVehI[playerid],1037);
                    AddVehicleComponent(PlayerVehI[playerid],1010);
                    AddVehicleComponent(PlayerVehI[playerid],1035);
                    AddVehicleComponent(PlayerVehI[playerid],1039);
                    AddVehicleComponent(PlayerVehI[playerid],1041);
                    AddVehicleComponent(PlayerVehI[playerid],1086);
                    AddVehicleComponent(PlayerVehI[playerid],1087);
                    AddVehicleComponent(PlayerVehI[playerid],1147);
                    AddVehicleComponent(PlayerVehI[playerid],1148);
                    AddVehicleComponent(PlayerVehI[playerid],1172);
                    SendClientMessage(playerid, COLOR_GREEN, "You selected a tuned Elegy");
                }
            }
        }
    }
    else
    {
        TogglePlayerControllable(playerid, 0);
        ShowMenuForPlayer(TunedVehicles,playerid);
        return 1;
    }
}
I TOLD YOU!!

You love indenting code :< You should charge for it.

ALso I didn't find the "Enjoy your ride" sendclietnmessage in there, please add that piece of code.
Reply
#6





Quote:

ALso I didn't find the "Enjoy your ride" sendclietnmessage in there, please add that piece of code.

it was just example...
Reply
#7

Urh, it looks like you didn't get the players pos.
By the way, how do you make a Created Vehicle not respawn,
Код:
CreateVehicle(ID, X, Y, Z, A, C, C, 0); ?
Reply
#8

still not work... any ideas?
Reply
#9

Firstly, if you get errors show them.
Secondly, place "GetPlayerPos(playerid, X, Y, Z);" above CreateVehicle.
Reply
#10

Did you try my script? ^o)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)