SA-MP Forums Archive
Need help with 'Test Drive' System - 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: Need help with 'Test Drive' System (/showthread.php?tid=647314)



Need help with 'Test Drive' System - MaestrulFritz - 03.01.2018

Alright, so I have tried creating my own test drive system in dealership, and for some reason, the vehicle does not spawn, like for real, the vehicle is not created, neither I get teleported into it. Can someone help?

Code here:
Код:
            if(pInfo[playerid][pScore] < 3) return SendClientMessage(playerid, COLOR_DARKGRAY, "You need at least level 3.");
            if(pInfo[playerid][pTotVeh]+1 >= pInfo[playerid][pSlotVeh]) return SendClientMessage(playerid, COLOR_DARKGRAY, "You don't have enough vehicles slot. (/shop -> Vehicle Slot)");
            switch(listitem)
            {
                case 0: pInfo[playerid][aVar][34] = 499; // Benson 116
                case 1: pInfo[playerid][aVar][34] = 422; // Bobcat 132
                case 2: pInfo[playerid][aVar][34] = 482; // Burrito 148
                case 3: pInfo[playerid][aVar][34] = 498; // Boxville 102
                case 4: pInfo[playerid][aVar][34] = 609; // Boxburg 103
                case 5: pInfo[playerid][aVar][34] = 578; // DFT-30 123
                case 6: pInfo[playerid][aVar][34] = 414; // Mule 100
                case 7: pInfo[playerid][aVar][34] = 600; // Picador 142
                case 8: pInfo[playerid][aVar][34] = 413; // Pony 104
                case 9: pInfo[playerid][aVar][34] = 440; // Rumpo 129
                case 10: pInfo[playerid][aVar][34] = 459; // Topfun 129
                case 11: pInfo[playerid][aVar][34] = 554; // Yosemite 136
            }
         
            SetPlayerPos(playerid, 1022.6226,-1121.4207,23.8724), SetPlayerVirtualWorldEx(playerid, 2);
			IDCar[playerid] = CreateVehicle(pInfo[playerid][aVar][34], 1022.6226,-1121.4207,23.8724,4.7584, 1, 1, -1);
            PutPlayerInVehicle(playerid, IDCar[playerid], 0);
            SetTimerEx("GeneralTimer", 50, false, "i", playerid);
        }
Firstly I thougt it's a [aVar][34] problem, but I replaced it with a static ID (at CreateVehicle) and still does not spawn.

Thank you.


Re: Need help with 'Test Drive' System - jasperschellekens - 03.01.2018

Quote:
Originally Posted by MaestrulFritz
Посмотреть сообщение
Alright, so I have tried creating my own test drive system in dealership, and for some reason, the vehicle does not spawn, like for real, the vehicle is not created, neither I get teleported into it. Can someone help?

Code here:
Код:
            if(pInfo[playerid][pScore] < 3) return SendClientMessage(playerid, COLOR_DARKGRAY, "You need at least level 3.");
            if(pInfo[playerid][pTotVeh]+1 >= pInfo[playerid][pSlotVeh]) return SendClientMessage(playerid, COLOR_DARKGRAY, "You don't have enough vehicles slot. (/shop -> Vehicle Slot)");
            switch(listitem)
            {
                case 0: pInfo[playerid][aVar][34] = 499; // Benson 116
                case 1: pInfo[playerid][aVar][34] = 422; // Bobcat 132
                case 2: pInfo[playerid][aVar][34] = 482; // Burrito 148
                case 3: pInfo[playerid][aVar][34] = 498; // Boxville 102
                case 4: pInfo[playerid][aVar][34] = 609; // Boxburg 103
                case 5: pInfo[playerid][aVar][34] = 578; // DFT-30 123
                case 6: pInfo[playerid][aVar][34] = 414; // Mule 100
                case 7: pInfo[playerid][aVar][34] = 600; // Picador 142
                case 8: pInfo[playerid][aVar][34] = 413; // Pony 104
                case 9: pInfo[playerid][aVar][34] = 440; // Rumpo 129
                case 10: pInfo[playerid][aVar][34] = 459; // Topfun 129
                case 11: pInfo[playerid][aVar][34] = 554; // Yosemite 136
            }
         
            SetPlayerPos(playerid, 1022.6226,-1121.4207,23.8724), SetPlayerVirtualWorldEx(playerid, 2);
			IDCar[playerid] = CreateVehicle(pInfo[playerid][aVar][34], 1022.6226,-1121.4207,23.8724,4.7584, 1, 1, -1);
            PutPlayerInVehicle(playerid, IDCar[playerid], 0);
            SetTimerEx("GeneralTimer", 50, false, "i", playerid);
        }
Firstly I thougt it's a [aVar][34] problem, but I replaced it with a static ID (at CreateVehicle) and still does not spawn.

Thank you.
Your last paramater in createvehicle is the problem. Using -1 will prevent the vehicle from respawning.
try setting it to 0 or 60


Re: Need help with 'Test Drive' System - MaestrulFritz - 03.01.2018

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
Your last paramater in createvehicle is the problem. Using -1 will prevent the vehicle from respawning.
try setting it to 0 or 60
Tried it now, still, doesn't want to spawn.


Re: Need help with 'Test Drive' System - Steph12 - 03.01.2018

With this: "SetPlayerVirtualWorldEx(playerid, 2);" you set the player in V-world 2.
How about putting the car in the same world?