Код:
stock create_vehicle(vmodel, Float:x, Float:y, Float:z, Float:vrot, cola, colb, vowned, label_text[], owner[])
{
new vehicleid=CreateVehicle( vmodel, x, y, z, vrot, cola, colb, 60*10);
format(gVehicle[vehicleid][Owner],24,"%s",owner);
gVehicle[vehicleid][pos][0]=x;
gVehicle[vehicleid][pos][1]=y;
gVehicle[vehicleid][pos][2]=z;
gVehicle[vehicleid][rot] =vrot;
gVehicle[vehicleid][col1] =cola;
gVehicle[vehicleid][col2] =colb;
gVehicle[vehicleid][model] =vmodel;
gVehicle[vehicleid][Owned] =vowned;
if(vowned == 1)
{
gVehicleText[vehicleid] = Create3DTextLabel( label_text, 0xFF0000AA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
Attach3DTextLabelToVehicle( gVehicleText[ vehicleid ] , vehicleid, 0.0, 0.0, 2.0);
}
gVehicles ++ ;
new query[128];
format(query,sizeof(query),"SELECT `v_id` FROM `vehicle_information` WHERE `valid`= 0 LIMIT 1");
mysql_function_query(gHandle,query,true,"OnVehicleCreation","i",vehicleid);
//gVehicle[vehicleid][model], gVehicle[vehicleid][pos][0], gVehicle[vehicleid][pos][1], gVehicle[vehicleid][pos][2], gVehicle[vehicleid][rot], gVehicle[vehicleid][col1], gVehicle[vehicleid][col2], gVehicle[vehicleid][Owner], gVehicle[vehicleid][Owned]
}
forward OnVehicleCreation(vehicleid);
public OnVehicleCreation(vehicleid)
{
new query[256],rows,f;
cache_get_data(rows,f);
if(rows == 1)
{
format(query,sizeof(query),"UPDATE `vehicle_information` SET `model`= %d, `x` = %f, `y`= %f, `z` = %f, `rot` = %f, `cola` = %d, `colb` = %d, `owner` = '%s', `owned` = %d, `valid`= 1 WHERE `valid` = 0 AND `v_id` = %d",gVehicle[vehicleid][model], gVehicle[vehicleid][pos][0], gVehicle[vehicleid][pos][1], gVehicle[vehicleid][pos][2], gVehicle[vehicleid][rot], gVehicle[vehicleid][col1], gVehicle[vehicleid][col2], gVehicle[vehicleid][Owner], gVehicle[vehicleid][Owned], cache_get_row_int(0,0) );
}
else
{
format(query,sizeof(query),"INSERT INTO `vehicle_information` ( `model`, `x`, `y`, `z`, `rot`, `cola`, `colb`, `owner`, `owned`, `valid`) VALUES( %d, %f, %f, %f, %f, %d, %d, '%s', %d, 1)",gVehicle[vehicleid][model], gVehicle[vehicleid][pos][0], gVehicle[vehicleid][pos][1], gVehicle[vehicleid][pos][2], gVehicle[vehicleid][rot], gVehicle[vehicleid][col1], gVehicle[vehicleid][col2], gVehicle[vehicleid][Owner], gVehicle[vehicleid][Owned] );
}
mysql_function_query(gHandle,query,true,"OnVehicleCreate","i",vehicleid);
}
forward OnVehicleCreate(vehicleid);
public OnVehicleCreate(vehicleid)
{
gVehicle[vehicleid][v_id] = mysql_insert_id();
}
stock create_vehicle_at_player(playerid, vmodel, cola, colb, vowned, label_text[], owner[])
{
new Float:x,Float:y,Float:z;
new Float:vrot;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,vrot);
create_vehicle(vmodel, x, y, z, vrot, cola, colb, vowned, label_text, owner)
}
CMD:mv(playerid,params[])
{
new vmodel,cole,colw,vowned,owner[24];
if(sscanf(params,"iiiis[24]",vmodel,cole,colw,vowned,owner))SendClientMessage(playerid,COLOR_YELLOW,"Correct Usage:/mv [modelid] [col] [col] [isowned] [owner]");
else if(vmodel == INVALID_VEHICLE_ID)SendClientMessage(playerid,COLOR_YELLOW,"Invalid Player Id Entered");
else
{
create_vehicle_at_player(playerid, vmodel, cole, colw, vowned,"", owner)
}
return 1;
}
just copy and pasted from my old script you are free to look through it i have not included the variables this is just for you to understand how it can be made possible
Hope this helps you last compiled and tested this about a year ago so not sure whether this works 100%