Need vehicles spawn command
#5

Quote:
Originally Posted by Joe Staff
Couple of problems with that.
  • GetVehicleModelIDFromName isn't in his GameMode so it will return an "Undefined Function" error
  • It looks likes you're destroying a vehicle who's vehicleid is the same as the modelid the player types in, which will result in unwanted actions
  • You create the vehicle with the variable 'carid' but put the player into the vehicle with the variable 'car' which is a modelid, and not a veihcleid.
I was about to mention that, I'll fix it to make it work with ID's only.
Код:
	if(strcmp(cmd, "/v", true) == 0) // can type /v carname/model
	{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, ORANGE, "Error: Use /v model name/ ID");
				return 1;
			}
			new car;
			if (car >= 611 || car <= 400)
			{
			  car = strval(tmp);
				if(car < 400 || car > 611) return SendClientMessage(playerid, RED, "ERROR: vehicle id must between 400 -611");
			}

			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, ORANGE, "ERROR: /veh [id] [color1] [color2]");
				return 1;
			}
			new color1 = strval(tmp);

			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, ORANGE, "ERROR: /veh [id] [color1] [color2]");
				return 1;
			}
			new color2 = strval(tmp);
			
			new Float:X,Float:Y,Float:Z,Float:A;
			GetPlayerPos(playerid, X,Y,Z);
			GetPlayerFacingAngle(playerid, A);
			new carid = CreateVehicle(car, X,Y,Z, A, color1, color2, 600000000);
			PutPlayerInVehicle(playerid, carid, 0);
			
		}
Reply


Messages In This Thread
Need vehicles spawn command - by JPonsen - 22.08.2009, 04:23
Re: Need vehicles spawn command - by [mad]MLK - 22.08.2009, 04:32
Re: Need vehicles spawn command - by Joe Staff - 22.08.2009, 04:39
Re: Need vehicles spawn command - by JPonsen - 22.08.2009, 04:43
Re: Need vehicles spawn command - by NeRoSiS - 22.08.2009, 05:34
Re: Need vehicles spawn command - by JPonsen - 22.08.2009, 05:39
Re: Need vehicles spawn command - by refshal - 22.08.2009, 05:45
Re: Need vehicles spawn command - by [mad]MLK - 22.08.2009, 05:46
Re: Need vehicles spawn command - by refshal - 22.08.2009, 05:49
Re: Need vehicles spawn command - by JPonsen - 22.08.2009, 05:58

Forum Jump:


Users browsing this thread: 2 Guest(s)