[Help] Spawning a Vehicle with zcmd and sscanf2 -
MacacoDoArtico - 13.08.2014
In first place, Sorry for my bad english.
I'm trying to do a command to spawn cars, but, and I can compile the GM, but, when i try to do the command it does nothing.
The pawn code is:
Код:
CMD:spawnar(playerid, params[])
{
new
idcarro,
cor1,
cor2;
if (sscanf(params, "iii", idcarro, cor1, cor2))
{
if (idcarro >= 612)
if (idcarro <=399)
{
new message[40], Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
format(message, sizeof(message), "Spawnaste um %s, conduz com cuidado!", idcarro);
new vehicleid = CreateVehicle(idcarro, x+3, y, z, a, cor1, cor2, 0);
PutPlayerInVehicle(playerid, vehicleid, 0);
SendClientMessage(playerid, 0xFF0000FF, message);
}
else SendClientMessage(playerid, 0xFFFFFFFF, "Uso:"COL_NICERED"/spawnar [VehicleID/Nome do Carro/Mota] [Cor1] [Cor2]");
}
return 1;
}
Ahn, another thing, i want to compare the resultes from a variable to a fix value
Код:
if (idcarro >= 612)
if (idcarro <=399)
Is this correct?
Re: [Help] Spawning a Vehicle with zcmd and sscanf2 -
MacacoDoArtico - 13.08.2014
Anyone?
Re: [Help] Spawning a Vehicle with zcmd and sscanf2 -
Abagail - 13.08.2014
First of all, what do you mean by "it doesnt work"? Does anything show up? - And secondly, you need to be more clear with the second thing, how-ever if I understand correctly your trying to do this,
pawn Код:
if(idcarro < 400 || idcarro > 612)
That would work for detecting if the vehicle model is valid, or not.
Re: [Help] Spawning a Vehicle with zcmd and sscanf2 -
MacacoDoArtico - 13.08.2014
yes, you understood correctly,it was that.
Before, it didn't do nothing when I typed "/spawn", it was because I had the erro in
Код:
if(idcarro < 400 || idcarro > 612)
I changed that and tryed the GM, but, it stills don't work, i will explain:
This is the code translated to English:
Код:
CMD:spawn(playerid, params[])
{
new
carid,
color1,
color2;
if (sscanf(params, "iii", carid, color1, color2))
{
if(carid < 400 || carid > 612)
{
new message[40], Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
format(message, sizeof(message), "You spawned a %s, Drive safely!", carid);
new vehicleid = CreateVehicle(carid, x+3, y, z, a, color1, color2, 0);
PutPlayerInVehicle(playerid, vehicleid, 0);
SendClientMessage(playerid, 0xFF0000FF, message);
}
else SendClientMessage(playerid, 0xFFFFFFFF, "Use:"COL_NICERED"/spawn [VehicleID/CarName] [Corlor1] [Color2]");
}
return 1;
}
Now, when I type "/spawn" it says "You spawned a Drive safely!" and when I type "/spawn 559 1 1" that, it was supposed to spawns a Jester with color1 - 1 and color2 - 1, it says "Use: /spawn [VehicleID/CarName] [Color1] [Color2]
If you didn't understand something, please ask.
Re: [Help] Spawning a Vehicle with zcmd and sscanf2 -
MacacoDoArtico - 13.08.2014
Abagail, I put the script working.
Thanks a lot for the briefing on the detecting if the vehicle model is valid, or not.
+REP