ModelID = 0 Color1 = 0 Color2 = 0 ParkX = 0.000000 ParkY = 0.000000 ParkZ = 0.000000 ParkAng = 0.000000 Plate = |
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; } |
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); } |
Reverse all these
x = gVehicleStats[voitureid][ParkX]; y = gVehicleStats[voitureid][ParkY]; z = gVehicleStats[voitureid][ParkZ]; to gVehicleStats[voitureid][ParkX] = x; gVehicleStats[voitureid][ParkY] = y; gVehicleStats[voitureid][ParkZ] = z; |
ModelID = 462 Color1 = 1 Color2 = 0 ParkX = -1998.803955 ParkY = 92.413574 ParkZ = 27.687500 ParkAng = 86.866607 Plate = A |
stock GetAvailableFileID() { new path[32]; for(new i; i<MAX_VEHICLES; i++) { format(path, sizeof(path), "Vehicles/%s.ini", i); if(!fexist(path)) { return i; } } return 0; } |