Dcmd/sscanf help - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dcmd/sscanf help (
/showthread.php?tid=170128)
Dcmd/sscanf help -
[NWA]Hannes - 22.08.2010
Got this under commandtext.
and heres the command
pawn Код:
dcmd_v(playerid, params[])
{
new car;
if(sscanf(params, "z", car)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /v [Vehicle ID]");
else if(car == INVALID_VEHICLE_ID) SendClientMessage(playerid, 0xFF0000AA, "Error: Unknown Vehicle ID");
else
{
new Float:X, Float:Y, Float:Z, Float:A, vehicle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
vehicle = CreateVehicle(car, X, Y, Z, A, 0, 0, -1);
PutPlayerInVehicle(playerid, vehicle, 0);
}
return 1;
}
But it dont work, any idea why?
Re: Dcmd/sscanf help -
Toni - 22.08.2010
Quote:
Originally Posted by [NWA]Hannes
Got this under commandtext.
and heres the command
pawn Код:
dcmd_v(playerid, params[]) { new car; if(sscanf(params, "z", car)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /v [Vehicle ID]"); else if(car == INVALID_VEHICLE_ID) SendClientMessage(playerid, 0xFF0000AA, "Error: Unknown Vehicle ID"); else { new Float:X, Float:Y, Float:Z, Float:A, vehicle; GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, A); vehicle = CreateVehicle(car, X, Y, Z, A, 0, 0, -1); PutPlayerInVehicle(playerid, vehicle, 0); } return 1; }
But it dont work, any idea why?
|
You have to use "i" or "d", since vehicle it's
id (number).
What you put was "z" which is a string that is optional, used for something like /kick id reason.
Re: Dcmd/sscanf help - [L3th4l] - 22.08.2010
pawn Код:
dcmd_v(playerid, params[])
{
new car;
if(sscanf(params, "i", car)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /v [Vehicle ID]");
if(car == INVALID_VEHICLE_ID) return SendClientMessage(playerid, 0xFF0000AA, "Error: Unknown Vehicle ID");
new Float:X, Float:Y, Float:Z, Float:A, vehicle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
vehicle = CreateVehicle(car, X, Y, Z, A, 0, 0, -1);
PutPlayerInVehicle(playerid, vehicle, 0);
return 1;
}
Edit - or do what Toni said :P