SA-MP Forums Archive
[HELP] Tuned Car Spawning Menu - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Tuned Car Spawning Menu (/showthread.php?tid=85813)



[HELP] Tuned Car Spawning Menu - cigo - 09.07.2009

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?


Re: [HELP] Tuned Car Spawning Menu - LarzI - 09.07.2009

http://ampaste.net/m1f0c36f

Try that


Re: [HELP] Tuned Car Spawning Menu - Chaprnks - 09.07.2009

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;
    }
}



Re: [HELP] Tuned Car Spawning Menu - cigo - 09.07.2009

in my gm i have 0 errors :/

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


Re: [HELP] Tuned Car Spawning Menu - NeRoSiS - 09.07.2009

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.


Re: [HELP] Tuned Car Spawning Menu - cigo - 09.07.2009





Quote:

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

it was just example...


Re: [HELP] Tuned Car Spawning Menu - Abernethy - 09.07.2009

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); ?



Re: [HELP] Tuned Car Spawning Menu - cigo - 09.07.2009

still not work... any ideas?


Re: [HELP] Tuned Car Spawning Menu - Abernethy - 09.07.2009

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


Re: [HELP] Tuned Car Spawning Menu - LarzI - 10.07.2009

Did you try my script? ^o)