Spawning Cars In-game /spawncar
#1

I need help with spawning cars in-game.
I was making the code for it but..
It compiles correctly,
But when I try it in-game, it don't work. I type /spawncar 420 (taxi) but nothing happens even the error message doesn't show up.

Here's my code:
Код:
CMD:spawncar(playerid, params[])
{
	new PlayerName[MAX_PLAYER_NAME],file[256],VehID,Float:VehX,Float:VehY,Float:VehZ,Float:VehA,SpawnedCar,string[128];
	GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	format(file, sizeof(file), ACCOUNT_FILE, PlayerName);
	
	if(sscanf(params, "i", VehID))
	{
		if(dini_Int(file, "AdminLevel") > 0)
		{
			if(VehID < 400 || VehID > 611)
			{
				SendClientMessage(playerid,SystemMSG,"[VEHICLE]: Invalid Vehicle Model, Vehicle Models range from 400-611.");
				return 1;
			}
			GetPlayerPos(playerid,VehX,VehY,VehZ);
			GetPlayerFacingAngle(playerid,VehA);

			SpawnedCar = CreateVehicle(VehID,VehX,VehY,VehZ,VehA,-1,-1,-1);
			LinkVehicleToInterior(SpawnedCar, GetPlayerInterior(playerid));
			SetVehicleVirtualWorld(SpawnedCar, GetPlayerVirtualWorld(playerid));

			PutPlayerInVehicle(playerid,SpawnedCar,0);
			format(string, 128, "[VEHICLE]: You have successfully spawned Vehicle Model %d!", VehID);
			SendClientMessage(playerid, SystemMSG, string);
		}
		else
		{
			SendClientMessage(playerid,SystemMSG,"[VEHICLE]: You need to be an Administrator to use that command!");
		}
	}
	return true;
}
I am using <zcmd> and <sscanf> and I am new to Pawn.

Please help me.
Reply


Messages In This Thread
Spawning Cars In-game /spawncar - by Desertsoulz - 26.02.2011, 23:15

Forum Jump:


Users browsing this thread: 1 Guest(s)