YCMD:veh(playerid, params[], help) { if(help) return SCM(playerid, COLOR_GREY, "Not supported"); if(PlayerInfo[playerid][pAdmin] >= 3) { new model, iColor[2], vid, Float:x, Float:y, Float:z, Float:angle; new engine,lights,alarm,doors,bonnet,boot,objective; if(sscanf(params,"dii",model, iColor[0],iColor[1])) return SCM(playerid, COLOR_GRAD, "USAGE: /veh [model id] [color1] [color2]"); if(model < 400 || model > 611) return SCM(playerid, COLOR_GREY, "[DEBUG]: Vehicle ID's must be between 400 - 611."); if(iColor[1] < 0 && iColor[1] > 126) { SCM(playerid, COLOR_GREY, "Invalid color ID."); } GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, angle); vid = CreateVehicle(model, x, y, z, angle, iColor[0], iColor[1], -1); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid, 1, lights, alarm, doors, bonnet, boot, objective); engineOn[vid] = true; SetVehicleNumberPlate(vid, "ADMIN"); PutPlayerInVehicle(playerid, vid, 0); } return 1; }
YCMD:veh(playerid, params[], help)
{
if(help) return SCM(playerid, COLOR_GREY, "Not supported");
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new veh_name[32], iColor[2];
if(sscanf(params,"s[32]ii",veh_name, iColor[0],iColor[1])) return SCM(playerid, COLOR_GRAD, "USAGE: /veh [vehicle name] [color1] [color2]");
new model = GetVehicleModelIDFromName(veh_name);
if(model == -1) return SCM(playerid, COLOR_GREY, "Invalid vehicle name");
if(iColor[1] < 0 && iColor[1] > 126) return SCM(playerid, COLOR_GREY, "Invalid color ID.");
new vid, Float:x, Float:y, Float:z, Float:angle, engine,lights,alarm,doors,bonnet,boot,objective;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
vid = CreateVehicle(model, x, y, z, angle, iColor[0], iColor[1], -1);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid, 1, lights, alarm, doors, bonnet, boot, objective);
engineOn[vid] = true;
SetVehicleNumberPlate(vid, "ADMIN");
PutPlayerInVehicle(playerid, vid, 0);
}
return 1;
}
The function there is still incorrect - TBH, you should keep a counter of the number of character matches, then return the ID with the most matches.
|