21.02.2012, 19:23
guys i tried to create a vehicle but when i typeit with the params sscanf still show me the right way to write.
pawn Код:
CMD:createveh(playerid, vehicleid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "No puedes usar este comando!");
new Model, Cor1, Cor2, Precio;
if(sscanf(params, "iiii", Model, Cor1, Cor2, Precio)) return SendClientMessage(playerid, -1, "/createveh [Model] [Color1] [Color2] [Price]");
new Float:Pos[4], Query[256];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
GetPlayerFacingAngle(playerid, Pos[3]);
CreateVehicle(Model, Pos[0], Pos[1], Pos[2], Pos[3], Cor1, Cor2, 15*60);
VehicleHasOwner[vehicleid] = 0;
CarKeys++;
veh_created++;
CarInfo[playerid][CarKey] = CarKeys;
CarInfo[playerid][Color1] = Cor1;
CarInfo[playerid][Color2] = Cor2;
CarInfo[playerid][Price] = Precio;
CarInfo[playerid][PosX] = Pos[0];
CarInfo[playerid][PosY] = Pos[1];
CarInfo[playerid][PosZ] = Pos[2];
CarInfo[playerid][Angle] = Pos[3];
strmid(CarInfo[veh_created][Owner], "Unbought", 0, 20, 20);
format(Query, sizeof(Query), "INSERT INTO `privateveh` (`vID`, `vModel`, `vColor1`, `vColor2`, `vPrice`, `vOwner`, `vPosX`, `vPosY`, `vPosZ`, `vPosA`, `vPlate`, `vPaintJ`) VALUES (%d, %d, %d, %d, %d, 'Unbought', %f, %f, %f, %f, 'ChangeME', 0)",
veh_created,
Model,
Cor1,
Cor2,
Precio,
Pos[0],
Pos[1],
Pos[2],
Pos[3]);
mysql_query(Query);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Veh Created SucessFully");
return 1;
}