22.08.2013, 16:43
Hi, i wanted to add a dynamic vehicle system (add them with a cmd) but i have a little problem, the saved file is empty and nameless :
Here is the cmd for creating the vehicle:
And here is the saving part
How to fix it please ?
Ps: Sorry for my english
Quote:
ModelID = 0 Color1 = 0 Color2 = 0 ParkX = 0.000000 ParkY = 0.000000 ParkZ = 0.000000 ParkAng = 0.000000 Plate = |
Quote:
CMD:creervoiture(playerid, params[]) { if(IsPlayerAdmin(playerid)) { new model,voitureid,couleura1,couleura2,plaque,Float ,Float:y,Float:z,Float:angle; if(sscanf(params, "iiis[32]",model,couleura1,couleura2,plaque)) return SendClientMessage(playerid, COLOR_RED, "Usage: /creervoiture [model] [couleur1] [couleur2] [plaque]"); GetPlayerPos(playerid, x, y , z); GetPlayerFacingAngle(playerid, angle); voitureid = AddStaticVehicleEx(model, x, y, z, angle, couleura1, couleura2, 300); model = gVehicleStats[voitureid][ModelID]; couleura1 = gVehicleStats[voitureid][Color1]; couleura2 = gVehicleStats[voitureid][Color2]; x = gVehicleStats[voitureid][ParkX]; y = gVehicleStats[voitureid][ParkY]; z = gVehicleStats[voitureid][ParkZ]; angle = gVehicleStats[voitureid][ParkAng]; plaque = gVehicleStats[voitureid][Plate]; SaveVehicle(voitureid); } else SendClientMessage(playerid, COLOR_RED, "Vous n'кtes pas un admin!"); return 1; } |
Quote:
stock SaveVehicle(i) { new path[32]; if(gVehicleStats[i][FileID] == 999) { gVehicleStats[i][FileID] = GetAvailableFileID(); } format(path, sizeof(path), "Vehicles/%s.ini", gVehicleStats[i][FileID]); new INI:handle = INI_Open(path); INI_WriteInt(handle,"ModelID", gVehicleStats[i][ModelID]); INI_WriteInt(handle,"Color1", gVehicleStats[i][Color1]); INI_WriteInt(handle,"Color2", gVehicleStats[i][Color2]); INI_WriteFloat(handle,"ParkX", gVehicleStats[i][ParkX]); INI_WriteFloat(handle,"ParkY", gVehicleStats[i][ParkY]); INI_WriteFloat(handle,"ParkZ", gVehicleStats[i][ParkZ]); INI_WriteFloat(handle,"ParkAng", gVehicleStats[i][ParkAng]); INI_WriteString(handle,"Plate", gVehicleStats[i][Plate]); INI_Close(handle); } |
Ps: Sorry for my english