help ini file
#1

hello, i'm trying to create a new ini file with this commands :
but the gm doesn't create the file.
Код:
#define PATH2 "Veicoli/%s.ini"
Код:
stock VehiclePath(vehicleid)
{
    new string[128],vname[MAX_VEHICLE_NAME];
    
    
    GetVehicleModel(vehicleid,vname,sizeof(vname));
	
    format(string,sizeof(string),PATH2,vname);
    return string;
}
Код:
CMD:veh(playerid, params[]) {

	new vehid;

	if(sscanf(params, "i", vehid)) SendClientMessage(playerid, COLOR_GREY, "SYNTAX: /veh <carid>");
	else if (vehid < 400 || vehid > 611) SendClientMessage(playerid, COLOR_GREY, "[ERROR] Invalid car id! [ Car ID's range from 400 - 611 ]");
	else
	{

		new Float:x, Float:y, Float:z;
		GetPlayerPos(playerid, x, y, z);
		CreateVehicle(vehid, x + 3, y, z, 0, 0,0, -1);
		SendClientMessage(playerid, COLOR_GREEN, "Car spawned at your location!");

		new INI:File = INI_Open(VehiclePath(vehid));


	 	INI_SetTag(File,"vehicle");

	    INI_WriteInt(File,"model",VehicleInfo[vehid][vModel]);
	    INI_Close(File);

	}

	return 1;
}
and gaves that error
Код:
C:\Users\User\Desktop\server 2\gamemodes\rp.pwn(972) : warning 202: number of arguments does not match definition
C:\Users\User\Desktop\server 2\gamemodes\rp.pwn(972) : warning 202: number of arguments does not match definition
Reply
#2

It's not an error and you can run your server but would give unexpected results.Please mention which line is line number 972.
Reply
#3

Quote:
Originally Posted by Yashas
Посмотреть сообщение
It's not an error and you can run your server but would give unexpected results.Please mention which line is line number 972.
Код:
 GetVehicleModel(vehicleid,vname,sizeof(vname));
Reply
#4

Ah,
GetVehicleModel(vehicleid) takes just one parameter and returns the modelid.
If you want the name of the vehicle do this:

Add this code above everything except the includes(doesn't matter):
Quote:

stock const VehicleNames[212][] = {
{"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunn er"},{"Perrenial"},{"Sentinel"},{"Dumper"},
{"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana "},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
{"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam "},{"Esperanto"},{"Taxi"},{"Washington"},
{"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{" Securicar"},
{"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barra cks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
{"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"R C Bandit"},{"Romero"},{"Packer"},{"Monster"},
{"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"} ,{"Tram"},{"Trailer 2"},{"Turismo"},
{"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Ya nkee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
{"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
{"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coa stguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
{"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Bu rrito"},{"Camper"},{"Marquis"},
{"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
{"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
{"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
{"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
{"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer" },{"Shamal"},{"Hydra"},{"FCR-900"},
{"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
{"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{ "Feltzer"},{"Remington"},{"Slamvan"},
{"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vinc ent"},{"Bullet"},{"Clover"},{"Sadler"},
{"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob "},{"Tampa"},{"Sunrise"},{"Merit"},
{"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{" Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
{"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"R C Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
{"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweep er"},
{"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
{"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"}, {"Club"},{"Freight Carriage"},
{"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
{"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
{"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
{"Utility Trailer"}
};

Then doing VehicleNames[MODELID-400] will give the vehicle name.
Or use this
Код:
stock GetVehicleName(mid)
{
    if(400 > mid > 612) return "Invalid Model ID";
    return VehicleNames[mid-400];
}
Credits to whoever did it.I never made it except a few changes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)