[SOLVED]The car doesn't spawn back...
#1

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

this is your problem

CreateVehicle(autko,

autoko needs to be a car MODEL id
Reply
#3

Quote:
Originally Posted by adsy
this is your problem

CreateVehicle(autko,

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

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);
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)