SA-MP Forums Archive
Help sscanf - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help sscanf (/showthread.php?tid=320131)



Help sscanf - ttloko2 - 21.02.2012

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;
}



Re: Help sscanf - MP2 - 21.02.2012

What did you type?


Re: Help sscanf - Vince - 21.02.2012

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



Re: Help sscanf - ttloko2 - 21.02.2012

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


Re: Help sscanf - MP2 - 21.02.2012

Remove vehicle from the CMD: line.


Re: Help sscanf - ttloko2 - 21.02.2012

@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.