Help sscanf
#1

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;
}
Reply
#2

What did you type?
Reply
#3

pawn Код:
CMD:createveh(playerid, vehicleid, params[])
Reply
#4

i typed the command, example: /createveh 415 1 1 0
, i used vehicleid because im using max_vehicles on vehicle has owner
Reply
#5

Remove vehicle from the CMD: line.
Reply
#6

@MP2 that would make me give error on isvehicleowned, i fixed it, solution was change from:

pawn Код:
CMD:createveh(playerid, vehicleid, params[])
to:

pawn Код:
CMD:createveh(playerid, params[], vehicleid)
Thank you anyway.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)