Problem with spawning a vehicle
#8

If it doesn't work still the use this one.
Код:
COMMAND:vc(playerid, params[])
{
	if(playerData[playerid][playerLoggedIn])
	{
		if(playerData[playerid][playerLevel] >= 3)
		{
			new message[128], vehName[16], vehID, Float:jX, Float:jY, Float:jZ, Float:jA;

			if(!sscanf(params, "s[16]", vehName))
			{
				vehID = getVehicleModelFromName(vehName);
				
				if(vehID < 400 || vehID > 612)
				{
					SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Unknown vehicle name provided!");
				}
				else
				{
					GetPlayerFacingAngle(playerid, jA);
					GetPlayerPos(playerid, jX, jY, jZ);
					
					if(vehID == 612)
					{
						if(playerData[playerid][playerLevel] >= 6)
						{
							SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
						}
						else
						{
							SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Due to the anti-cheat method this server uses, you're unable to spawn a jetpack.");
						}
					}
					else
					{
						for(new v = 0; v < MAX_ADMIN_SPAWNED_VEHICLES; v++)
						{
							if(!adminSpawnedVehicles[v])
							{
								adminSpawnedVehicles[v] = CreateVehicle(vehID, jX, jY, jZ, jA, random(255), random(255), 120);
								LinkVehicleToInterior(adminSpawnedVehicles[v], GetPlayerInterior(playerid));
								SetVehicleVirtualWorld(adminSpawnedVehicles[v], GetPlayerVirtualWorld(playerid));
								ac_PutPlayerInVehicle(playerid, adminSpawnedVehicles[v], 0);
								format(message, sizeof(message), "{02FBF2}[ADMIN] {FFFFFF}You have spawned a %s", vehicleNames[vehID - 400]);
								SendClientMessage(playerid, COLOR_WHITE, message);
								
								break;
							}
							
							if(v == (MAX_ADMIN_SPAWNED_VEHICLES - 1))
							{
								SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Too many administrator vehicles have been spawned, remove some before trying again.");
							}
						}
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Usage: \"vc <vehicle name>\"");
			}
		}
		else
		{
			return 0;
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
	}
	
	return 1;
}
Reply


Messages In This Thread
Problem with spawning a vehicle - by benjaminjones - 27.08.2015, 23:32
Re: Problem with spawning a vehicle - by bensmart469 - 27.08.2015, 23:52
Re: Problem with spawning a vehicle - by benjaminjones - 28.08.2015, 00:43
Re: Problem with spawning a vehicle - by benjaminjones - 28.08.2015, 14:43
Re: Problem with spawning a vehicle - by Logofero - 28.08.2015, 14:59
Re: Problem with spawning a vehicle - by Boot - 28.08.2015, 15:08
Re: Problem with spawning a vehicle - by benjaminjones - 28.08.2015, 17:32
Re: Problem with spawning a vehicle - by GuthiX - 28.08.2015, 18:10
Re: Problem with spawning a vehicle - by benjaminjones - 28.08.2015, 18:50

Forum Jump:


Users browsing this thread: 2 Guest(s)