SA-MP Forums Archive
Why Car Menu wont work?? :( - 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)
+--- Thread: Why Car Menu wont work?? :( (/showthread.php?tid=426565)



Why Car Menu wont work?? :( - Gamer_007 - 29.03.2013

Guys i copied the vehicle menu from Rajat_pawar's 0.3x Model Preveiw Script.My script compiling fine,showing me the menu but it wont spawn car.Here is the code

pawn Код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
            if(listid == alist)
            {
            if(response)
            {
            if(modelid==411)
            {
            ShowModelSelectionMenu(playerid,vlist,"Car menu.");
            return 1;
            }
            }
            if(listid==vlist)
            {
            if(response)
            {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            CreateVehicle(modelid,x+2,y+2,z+2,0,0,0,0);
            SendClientMessage(playerid,COLOR_ORANGE,"You have spawned the required car.");
            selectingcar[playerid]=0;
            }
            }
            }
            return 1;
}



Re: Why Car Menu wont work?? :( - Gamer_007 - 30.03.2013

BUMP!! ? ? Anyone please?


Re: Why Car Menu wont work?? :( - RajatPawar - 30.03.2013

pawn Код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
            if(listid == alist)
            {
                if(response)
                {
                    if(modelid==411)
                    {
                    ShowModelSelectionMenu(playerid,vlist,"Car menu.");
                    return 1;
                    }
                }
            }
            if(listid==vlist)
            {
                if(response)
                {
                    new Float:x, Float:y, Float:z;
                    GetPlayerPos(playerid, x, y, z);
                    CreateVehicle(modelid, x+2, y+2, z+2, 0, 0, 0, 0);
                    SendClientMessage(playerid,COLOR_ORANGE,"You have spawned the required car.");
                    selectingcar[playerid]=0;
                }
            }
            return 1;
}
You had an extra brace there.. Which is why indention is so damn useful.


Re: Why Car Menu wont work?? :( - Gamer_007 - 30.03.2013

one more problem Rajt

I made that when players select tha car,the car spawns and the player is put inisde it.All codes compiling fine, but it wotn work.Below is the code

pawn Код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
            if(listid == alist)
            {
                if(response)
                {
                    if(modelid==411)
                    {
                    ShowModelSelectionMenu(playerid,vlist,"Car menu.");
                    return 1;
                    }
                }
            }
            if(listid==vlist)
            {
                if(response)
                {
                    if(SpawnedVehicles[playerid] != 0) DestroyVehicle(SpawnedVehicles[playerid]);
                    new Float:x, Float:y, Float:z, Float:ROT;
                    GetPlayerPos(playerid, x, y, z);
                    GetPlayerFacingAngle (playerid,ROT);
                    SpawnedVehicles[playerid] = CreateVehicle(modelid,x,y,z,ROT,-1,-1,60);
                    PutPlayerInVehicle(playerid,SpawnedVehicles[playerid],0);
                    selectingcar[playerid]=0;

                }
            }
            return 1;
}



Re: Why Car Menu wont work?? :( - RajatPawar - 30.03.2013

pawn Код:
if(SpawnedVehicles[playerid] != 0) return DestroyVehicle(SpawnedVehicles[playerid]);
else{
                    new Float:x, Float:y, Float:z, Float:ROT;
                    GetPlayerPos(playerid, x, y, z);
                    GetPlayerFacingAngle (playerid,ROT);
                    SpawnedVehicles[playerid] = CreateVehicle(modelid,x,y,z,ROT,-1,-1,60);
                    PutPlayerInVehicle(playerid,SpawnedVehicles[playerid],0);
                    selectingcar[playerid]=0;
 }