Trailer command - 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: Trailer command (
/showthread.php?tid=432880)
Trailer command -
Mattakil - 24.04.2013
pawn Код:
CMD:tow(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
new string[128];
if(isnull(params))
{
SendClientMessage(playerid, -1, "Usage: /tow [VehicleID]");
SendClientMessage(playerid, -1, "Hint: Use /dl to find the ID of the vehicle to tow");
}
if(!strcmp(params, "%s", false))
{
format(string, 3, "%s", params);
if(GetVehicleModel(vehicleid) == 525 & 554 & 489 & 490)
{
AttachTrailerToVehicle(vehicleid, string);
return 1;
}
}
}
return 0;
}
It shows an error for the line "AttachTrailerToVehicle" How do I show the string in the function?
Re: Trailer command -
Mattakil - 24.04.2013
Anyone know?
Re: Trailer command -
RVRP - 24.04.2013
Post the error.
Re: Trailer command -
Scyattica - 24.04.2013
Can't use a string in AttachTrailerToVehicle, Need to use an integer. Try using
sscanf to convert the params into an integer. Be much easier.
Код:
new id;
sscanf(params, "i", id);
AttachTrailerToVehicle(id, vehicleid);
Re: Trailer command -
Mattakil - 25.04.2013
Thanks, it worked, any idea on how to use IsPlayerInRangeOfPoint for the vehicle to be towed??
Re: Trailer command -
Scyattica - 25.04.2013
Код:
new Float:x, Float:y, Float:z;
GetVehPos(id, x, y, z); // id = trailer id
If(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
{
//Let's code stuff
//end of code
}
Re: Trailer command -
Mattakil - 25.04.2013
oh, okay..thanks guys! +rep