SA-MP Forums Archive
Im needing command /tow - 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: Im needing command /tow (/showthread.php?tid=253655)



Im needing command /tow - GBLTeam - 07.05.2011

Can anyone give me code from the /tow because i need that to mechanic job...


Re: Im needing command /tow - dud - 07.05.2011

take it from GTARP or Raven


Re: Im needing command /tow - rati555 - 07.05.2011

pawn Код:
if(strcmp(cmd,"/tow",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pJob] == 7)
            {
                if(IsPlayerInAnyVehicle(playerid))
                {
                    new m = GetVehicleModel(GetPlayerVehicleID(playerid));
                    if (m == 525 || m == 552)
                    {
                        if(GetPlayerState(playerid)==2)
                        {
                            new Float:pX,Float:pY,Float:pZ;
                            GetPlayerPos(playerid,pX,pY,pZ);
                            new Float:vX,Float:vY,Float:vZ;
                            new Found=0;
                            new vid=0;
                            while((vid<MAX_VEHICLES)&&(!Found))
                            {
                                vid++;
                                GetVehiclePos(vid,vX,vY,vZ);
                                if ((floatabs(pX-vX)<7.0)&&(floatabs(pY-vY)<7.0)&&(floatabs(pZ-vZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
                                {
                                    Found=1;
                                    if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
                                    {
                                        DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
                                    }
                                    else
                                    {
                                        AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
                                    }
                                }
                            }
                            if(!Found)
                            {
                                SendClientMessage(playerid,0xFFFF00AA,"There is no car in range.");
                            }
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "You need to be the driver!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "You need to be in a Tow truck to use this!");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "You need to be in a vehicle to do this!");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid,COLOR_GRAD2,"You need to be a Mechanic to use this!");
                return 1;
            }
        }
        return 1;
    }
From GTA:RP