09.02.2010, 07:58
Okay, I use dini for most of my systems and I made an initial command for admins creating vehicles but I'm still unsure about how I'm going to approach it the way I want
I want people to be able to be able to own up to 5 vehicles and do /v 1 /v 2 etc to access their car but I'm not sure how to approach this because you I don't know how I could pass a variable into a dialog all I could think if doing is making 5 commands like v1 v2 v3 v4 v5 with 5 different dialogs which just seems like a waste.
I really need help here.
Код:
dcmd_vehown (playerid, params[]) { new model, color1, color2, Float:x, Float:y, Float:z, Float:pa, slots, string[128]; if (PlayerInfo[playerid][pLogged] == 0) return SendClientMessage(playerid,COLOR_SYSTEM ,"Not Logged In"); if (PlayerInfo[playerid][pAdmin] == 5) { if(sscanf(params, "dddd", model, color1, color2, slots)) return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /vehown [model id] [color id 1] [color id 2] [inventory slots]"); if(model<400||model>611) return SendClientMessage(playerid, COLOR_SYSTEM, "Vehicle Number can't be below 400 or above 611!"); if(color1 < 0 || color1 > 126) return SendClientMessage(playerid, COLOR_SYSTEM, "Color Number can't be below 0 or above 126!"); if(color2 < 0 || color2 > 126) return SendClientMessage(playerid, COLOR_SYSTEM, "Color Number can't be below 0 or above 126!"); new file[128]; format(file, sizeof(file), "/VehSys/Veh - %d", veh); dini_Create(file); { format(Vehicle[veh][VehOwner], 128, PlayerName(playerid)); Vehicle[veh][VehModel] = model; Vehicle[veh][VehColor1] = color1; Vehicle[veh][VehColor2] = color2; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid,pa); Vehicle[veh][VehSpawnX] = x; Vehicle[veh][VehSpawnY] = y; Vehicle[veh][VehSpawnZ] = z; Vehicle[veh][VehAngle] = pa; Vehicle[veh][VehInv] = slots; Vehicle[veh][Fuel] = 100; dini_Set(file, "VehOwner", PlayerName(playerid)); dini_IntSet(file, "VehModel", model); dini_IntSet(file, "VehColor1", color1); dini_IntSet(file, "VehColor2", color2); dini_FloatSet(file, "VehSpawnX", x); dini_FloatSet(file, "VehSpawnY", y); dini_FloatSet(file, "VehSpawnZ", z); dini_FloatSet(file, "VehAngle", pa); dini_IntSet(file, "VehFuel", 100); CreateVehicle(Vehicle[veh][VehModel],Vehicle[veh][VehSpawnX],Vehicle[veh][VehSpawnY],Vehicle[veh][VehSpawnZ],Vehicle[veh][VehAngle],Vehicle[veh][VehColor1],Vehicle[veh][VehColor2],0); veh++; format(string, sizeof(string), "ADMIN %s (%s): created a Vehicle %d (Model : %d, Color 1: %d, Color 2: %d) on %s.", PlayerName(playerid), GetIp(playerid), veh, model, color1, color2, TimeDate()); AdminLog(string); } } return 1; } dcmd_v(playerid, params[]) { new id; if (PlayerInfo[playerid][pLogged] == 0) return SendClientMessage(playerid,COLOR_SYSTEM ,"Not Logged In"); if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /v [Vehicle 1-5]"); if(id < 1 || id > 5) return SendClientMessage(playerid, COLOR_SYSTEM, "You must choose a Vehicle ID between 1 or 5"); ShowPlayerDialog(playerid, 2 ,DIALOG_STYLE_LIST,"Vehicle Menu",listveh,"Select","Cancel"); return 1; }
I really need help here.