Code don't work, - Please help!
#1

Hello,
I try to make a code that makes possible to tow other cars with a towtruck, Only this piece of code dont work, whats wrong with it?:

Код:
dcmd_tow(playerid, cmdtext[]) {
	#pragma unused cmdtext
	new VID = GetPlayerVehicleID(playerid);
	if(GetVehicleModel(VID) != 525) {
	    SendClientMessage(playerid, COLOR_RED,"You have to be in a towtruck to tow a car."); return 1;
    }
	if(GetPlayerVehicleSeat(playerid) != 0) {
        SendClientMessage(playerid, COLOR_RED,"You have to be the driver to tow a car."); return 1;
    }
    new Float:vX,Float:vY,Float:vZ;
    new towtruckdriver = playerid;
    for(new c = 0; c < MAX_VEHICLES; c++)
	{
		GetVehiclePos(c, vX, vY, vZ);
		if(IsPlayerInRangeOfPoint(towtruckdriver, 20.0, vX, vY, vZ))
		{
           	AttachTrailerToVehicle(c, VID);
           	SendClientMessage(towtruckdriver, COLOR_RED,"You have succesfully attached a vehicle!");
           	return 1;
		}
 		else
  		{
			SendClientMessage(towtruckdriver,COLOR_RED,"There is no towable vehicle in range.");
			return 1;
		}
	}
}
NOTE: I know that there's a filterscript that does this, but i want to make it myself.
Reply


Messages In This Thread
Code don't work, - Please help! - by Danny - 30.09.2010, 13:41
Re: Code don't work, - Please help! - by wups - 30.09.2010, 14:37
Re: Code don't work, - Please help! - by samgreen - 01.10.2010, 01:14

Forum Jump:


Users browsing this thread: 2 Guest(s)