SA-MP Forums Archive
[SOLVED]The car doesn't spawn back... - 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: [SOLVED]The car doesn't spawn back... (/showthread.php?tid=141417)



[SOLVED]The car doesn't spawn back... - Kuba_PL - 13.04.2010

pawn Код:
dcmd_r(playerid,params[])
{
        #pragma unused params
        if(IsPlayerInAnyVehicle(playerid))
        {
             TogglePlayerControllable(playerid,0);
              new autko, car;
             autko = GetPlayerVehicleID(playerid);
            new Float:CarX,Float:CarY,Float:CarZ,Float:CarAngle;
               DestroyVehicle(autko);
             GetPlayerPos(playerid,CarX,CarY,CarZ);
              SetPlayerPos(playerid,CarX,CarY,CarZ+1);
             GetPlayerFacingAngle(playerid,CarAngle);
             car = CreateVehicle(autko, CarX, CarY, CarZ, CarAngle, -1, -1, -1);
             PutPlayerInVehicle(playerid,car,0);
             TogglePlayerControllable(playerid,1);
             return 1;
         }
          return SendClientMessage(playerid,COLOR_RED,"You need to be in a vehicle to use this command!");
}
No errors or warnings while compiling, just the car doesn't spawn back (I mean the "car = CreateVehicle(autko, CarX.....")


Re: The car doesn't spawn back... - adsy - 13.04.2010

this is your problem

CreateVehicle(autko,

autoko needs to be a car MODEL id


Re: The car doesn't spawn back... - Kuba_PL - 13.04.2010

Quote:
Originally Posted by adsy
this is your problem

CreateVehicle(autko,

autoko needs to be a car MODEL id
pawn Код:
autko = GetPlayerVehicleID(playerid);



Re: The car doesn't spawn back... - adsy - 13.04.2010

Quote:
Originally Posted by Kuba_PL
Quote:
Originally Posted by adsy
this is your problem

CreateVehicle(autko,

autoko needs to be a car MODEL id
pawn Код:
autko = GetPlayerVehicleID(playerid);
thats getting the vehicle id

you want the model of the vehicle

Код:
vehicleid = GetPlayerVehicleID(playerid);
autko = GetVehicleModelID(vehicleid);



Re: The car doesn't spawn back... - Kuba_PL - 13.04.2010

Quote:
Originally Posted by adsy
Quote:
Originally Posted by Kuba_PL
Quote:
Originally Posted by adsy
this is your problem

CreateVehicle(autko,

autoko needs to be a car MODEL id
pawn Код:
autko = GetPlayerVehicleID(playerid);
thats getting the vehicle id

you want the model of the vehicle

Код:
vehicleid = GetPlayerVehicleID(playerid);
autko = GetVehicleModelID(vehicleid);
vehid = GetPlayerVehicleID(playerid);
autko = GetVehicleModel(vehid);



It works, Thanks