03.06.2010, 05:50
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:
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);