sorry for double post, but is it possible to add that function in OnPlayertCommandText()
Код:
if(strcmp(cmd, "/addvehicle", true) == 0){
new addmodelid, color1, color2, addtmp[256], addquery[512];
new Float:x, Float:y, Float:z, Float:Angle;
if(PlayerInfo[playerid][AdminLevel] < 10){
SendClientMessage(playerid, COLOR_RED, "You must be server administrator if you want to add faction car.");
return 1;
}
addtmp = strtok(cmdtext, idx);
if(!strlen(addtmp)){
SendClientMessage(playerid, COLOR_GREY, "USAGE: /addvehicle [model_id] [color1] [color2]");
return 1;
}
addmodelid = strval(addtmp);
addtmp = strtok(cmdtext, idx);
if(!strlen(addtmp)){
SendClientMessage(playerid, COLOR_GREY, "USAGE: /addvehicle [model_id] [color1] [color2]");
return 1;
}
color1 = strval(addtmp);
addtmp = strtok(cmdtext, idx);
if(!strlen(addtmp)){
SendClientMessage(playerid, COLOR_GREY, "USAGE: /addvehicle [model_id] [color1] [color2]");
return 1;
}
color2 = strval(addtmp);
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, Angle);
format(addquery, sizeof(addquery), "INSERT INTO static_vehicles (model_id, x, y, z, angle, color1, color2) VALUES (%d, %f, %f, %f, %f, %d, %d)", addmodelid, x, y, z, Angle, color1, color2);
mysql_query(addquery);
wait(3);
new vehid, message[128];
vehid = CreateVehicle(addmodelid, x, y, z, Angle, color1, color2, 600);
format(message,sizeof(message), "SA-%i-LS", vehid);
VehicleLicense[vehid] = Create3DTextLabel(message, COLOR_LIGHTBLUE, 0.0, 0.0, 0.0, 25.0, GetVehicleVirtualWorld(vehid), 1);
Attach3DTextLabelToVehicle(VehicleLicense[vehid], vehid, 0.0, -2.0, 0.0);
return 1;
}