Car dealership
#1

After many times trying to figure this out myself and many times failing and getting confused and annoyed ive come here.

Basicly im trying to create a simple vehicle system that when you buy that car is registered to your name so if anybdy enters they get kicked from the vehicle cause they dont own it.

Well im getting stuck on setting a vehicles owner and also checking a vehicles owner can anyone help before i explode?

EDIT: i had a look at a filterscript to see if that may help me and found this function:
pawn Код:
stock CreatePrivateVehicle(playername[],modelid,Float:x,Float:y,Float:z,Float:rot,c1,c2,price)
{
    new id = GenerateID();
    if(id == -1)
    {
        printf("vDealer: Error! Max ammount of private vehicles reached (%i)! could not create vehicle",M_VEHICLES);
        return 1;
    }

    format(PrivateVehicles[id][_owner],MAX_PLAYER_NAME,"%s",playername);
    PrivateVehicles[id][_modelid] = modelid;
    PrivateVehicles[id][_x] = x;
    PrivateVehicles[id][_y] = y;
    PrivateVehicles[id][_z] = z;
    PrivateVehicles[id][_rot] = rot;
    PrivateVehicles[id][_c1] = c1;
    PrivateVehicles[id][_c2] = c2;
    PrivateVehicles[id][_price] = price;

    #if USE_MYSQL_DATABASE == true
        yoursql_insert("vehicles","isiffffiii",id,playername,modelid,x,y,z,rot,c1,c2,price);
    #else
        new file[64];
        format(file,sizeof file,VEHICLE_PATH,id);
        new INI:handler = INI_Open(file);
        INI_WriteString(handler,"_owner",playername);
        INI_WriteInt(handler,"_modelid",modelid);
        INI_WriteFloat(handler,"_x",x);
        INI_WriteFloat(handler,"_y",y);
        INI_WriteFloat(handler,"_z",z);
        INI_WriteFloat(handler,"_rot",rot);
        INI_WriteInt(handler,"_c1",c1);
        INI_WriteInt(handler,"_c2",c2);
        INI_WriteInt(handler,"_price",price);
        INI_Close(handler);
    #endif
    PrivateVehicles[id][_vehicleid] = AddStaticVehicle(modelid,x,y,z,rot,c1,c2);
    SetVehicleNumberPlate(PrivateVehicles[id][_vehicleid],PrivateVehicles[id][_owner]);
    SetVehicleToRespawn(PrivateVehicles[id][_vehicleid]);
    return PrivateVehicles[id][_vehicleid];
}
I got totally lost on the id part
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)