Car Filterscript Issue, need help immediately.
#1

So basically I'm implementing this car filterscript but I have a problem with creating the vehicles. Everything else is fine.

pawn Код:
// Here I tried to CreateVehicle and load the model and everything else, did not work.
public OnPlayerConnect(playerid)
{
...
    if(dini_Exists(File))
    {
        CreateVehicle(dini_Int(File, "Model"), dini_Float(File, "X"), dini_Float(File, "Y"), dini_Float(File, "Z"), dini_Float(File, "Angle", 0.0, -1, -1, 600000);
        return 1;
    }
    ...
    return 1;
}
pawn Код:
// Here I tried to create the vehicle at a random position then setting the X, Y, Z and Angle of the vehicle, did not work either.
public OnPlayerConnect(playerid)
{
//if dini exists crap...
    SetVehiclePos(dini_Int(File, "Vehicle ID"), dini_Float(File, "X"), dini_Float(File, "Y"), dini_Float(File, "Z"));
    SetVehicleZAngle(dini_Int(File, "Vehicle ID"), dini_Float(File, "Angle"));
    ...
    return 1;
}
I want to get through this issue as soon as possible, so if you could try and help me that would be great.

P.S. This is not the full code, full code is not needed, but if you need it, just reply here.
Reply
#2

Is there anything at the X Y and Z coordinates? Also don't think you need dini_Float for that, use dini_Int
Reply
#3

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
Is there anything at the X Y and Z coordinates? Also don't think you need dini_Float for that, use dini_Int
Yes, that's where the car is saved when the player types /park.

Oh, and I do need _Float, because X, Y, Z is Float, and if I have _Int, it represents the X, Y, Z as an integer and I appear somewhere stupid.

I just need to know how to load the car, CreateVehicle ain't workin'
Reply
#4

More than 36 hours passed.

Here is how I load the cars now:

pawn Код:
COMMAND:loadcar(playerid, params[])
{
    new CarFile[100], pname[24];
    new vehicleid = GetPlayerVehicleID(playerid);
    if(PlayerHasCar[playerid] == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "You don't own a car.");
        return 1;
    }
    if(PlayerHasCar[playerid] == 0 && vOwned[vehicleid] == 0 && vOwned[vehicleid] == 1)
    {
        SendClientMessage(playerid, COLOR_RED, "You don't own a car or this is not your car.");
        return 1;
    }
    format(CarFile, sizeof(CarFile), "Server Data/Vehicles/%s.ini",pname);
    CreateVehicle(dini_Int(CarFile, "Model"), dini_Float(CarFile, "X"), dini_Float(CarFile, "Y"), dini_Float(CarFile, "Z"), dini_Float(CarFile, "Angle"), -1, -1, 600000);
    SendClientMessage(playerid, COLOR_WHITE, "You have loaded your vehicle.");
    return 1;
}
It does not load, what can I do?
Reply
#5

Quote:
Originally Posted by TheHoodRat
Посмотреть сообщение
More than 36 hours passed.

Here is how I load the cars now:

pawn Код:
//CODE
It does not load, what can I do?
Debug the problem out

But first of all add a check if the file exist (dini_Exists), without you never know if you entered the correct filename
Reply
#6

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
But first of all add a check if the file exist, without you never know if you entered the correct filename
I tried that, and it was just that it was reading the wrong file, thank you, you will be added in my credits list.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)