Get vehicle ID from name?
#1

I am making a system where a player can "call" a car and it will spawn next to them. Now instead of doing, for example, /callname, /callname2, etc, I am trying to use dcmd and sscanf to return the vehicle ID from the car name, loaded as the sscanf params. I have each vehicle created in an enumeration with the name as one of the values. Is it possible to return the car id from this value?

Let me post some of the code so you can see:
Код:
enum CarInfo
{
	Name[24],
	Locked,
	Kill,
	Model,
	Color1,
	Color2
}
new cInfo[MAX_CARS][CarInfo];

public OnFilterScriptInit()
{
	carname= AddStaticVehicle(model, x, y, z, color, color2);
	return 1;
}
Код:
dcmd_callcar(playerid, params[])
{
	new Float:px, Float:py, Float:pz, carname;
	if(sscanf(params, "s", carname)) SendClientMessage(playerid, COLOR_RED, "[Usage:] /callcar [car name]");
	else
	{
		GetPlayerPos(playerid, px, py, pz);
		SetVehiclePos(*VEHICLE ID AS VAR?*, px-5, py, pz);
Reply


Messages In This Thread
Get vehicle ID from name? - by randomkid88 - 03.06.2010, 05:50
Re: Get vehicle ID from name? - by cessil - 03.06.2010, 06:06
Re: Get vehicle ID from name? - by Backwardsman97 - 03.06.2010, 06:09
Re: Get vehicle ID from name? - by randomkid88 - 03.06.2010, 06:28
Re: Get vehicle ID from name? - by Backwardsman97 - 03.06.2010, 06:38
Re: Get vehicle ID from name? - by randomkid88 - 03.06.2010, 14:48
Re: Get vehicle ID from name? - by RyDeR` - 03.06.2010, 14:52
Re: Get vehicle ID from name? - by randomkid88 - 03.06.2010, 15:34
Re: Get vehicle ID from name? - by Joe_ - 03.06.2010, 15:55
Re: Get vehicle ID from name? - by RyDeR` - 03.06.2010, 19:18

Forum Jump:


Users browsing this thread: 1 Guest(s)