Need help with 'Test Drive' System
#1

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.
Reply
#2

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
Reply
#3

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.
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)