Attach 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: Attach command (
/showthread.php?tid=284680)
Attach command -
boyan96 - 20.09.2011
How i can make command when one vehicle is near to other and the drive write /attach to attach the vehicle behind him
Re: Attach command -
boyan96 - 20.09.2011
first vehicle to attach the second vehicle and when the first vehicle run the second vehicle go after first vehicle
Re: Attach command -
|_ⒾⓇⓄN_ⒹⓄG_| - 20.09.2011
pawn Код:
CMD:attach(playerid,params[])
{
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
new Float:vXx,Float:vYx,Float:vZx;
new Found=0;
new vid=0;
while((vid<MAX_VEHICLES)&&(!Found))
{
vid++;
GetVehiclePos(vid,vXx,vYx,vZx);
if ((floatabs(pX-vXx)<7.0)&&(floatabs(pY-vYx)<7.0)&&(floatabs(pZ-vZx)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
{
Found=1;
if (IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
}
AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
}
}
if (!Found)
{
SendClientMessage(playerid,red,"Can't Attach!Any Vehicle Found!");
}
return 1;
}
Re: Attach command -
Davz*|*Criss - 20.09.2011
Same code, But the changes in your code are: It's STRCMP and there are much spaces, Bad code lolz, But anyway good work, You converted into STCMP.
Re: Attach command -
boyan96 - 20.09.2011
thank you
Re: Attach command -
boyan96 - 20.09.2011
but when in vehicle have a player a can't attach the vehicle
Re: Attach command -
boyan96 - 20.09.2011
Can make even a man can still be attached
Re: Attach command -
|_ⒾⓇⓄN_ⒹⓄG_| - 20.09.2011
no you can't
vehicles with players inside can't be towed... sorry