04.04.2015, 15:50
I made a system to create and store vehicle in each file more'm having trouble operating the load it when you open the server.
This Part is working very good
but here is not working.
OnGameModeInit()
This Part is working very good
Код:
CMD:buycar(playerid, params[]) { new Model; if (sscanf(params, "dd", Model)) { SendClientMessage( playerid,-1,"{FFFFFF}/buycar [Model]"); } new count = 0; while(count >= 0) { new dir[56] = "/Orgs/OrgFBI/Cars/.ini"; new count_string[32]; valstr(count_string, count); strins(dir, count_string, 20); if(!fexist(dir)) { new Float:x, Float:y, Float:z,Float:Angle; GetPlayerFacingAngle(playerid, Angle); GetPlayerPos(playerid, x, y, z); new INI:ini = INI_Open(dir); INI_WriteFloat(ini,"Cordx",x); INI_WriteFloat(ini,"Cordy",y); INI_WriteFloat(ini,"Cordz",z); INI_WriteFloat(ini,"Angle",Angle); INI_WriteInt(ini, "Model", Model); INI_Close(ini); break; } count++; } return 1; }
Код:
#define MAX_CARORG (10) forward LoadCars(); enum cInfoOrg { CarModel, CarCordx, CarCordy, CarCordz, CarAnggle, } new CarInfoOrg[MAX_CARORG][cInfoOrg];
Код:
LoadCars(); new count = 0; while(count >= 0) { new dir[56] = "/Orgs/OrgFBI/Cars/.ini"; new count_string[32]; valstr(count_string, count); strins(dir, count_string, 20); if(fexist(dir)) { new INI:ini = INI_Open(dir); CarInfoOrg[CarCordx] = INI_Float(ini,"Cordx"); CarInfoOrg[CarCordy] = INI_Float(ini,"Cordy"); CarInfoOrg[CarCordz] = INI_Float(ini,"Cordz"); CarInfoOrg[CarAngle] = INI_Float(ini,"Angle"); CarInfoOrg[CarModel] = INI_Int(ini, "Modelo"); AddStaticVehicleEx(CarInfoOrg[dir][CarCordx],CarInfoOrg[dir][CarCordy],CarInfoOrg[dir][CarCordz],CarInfoOrg[dir][CarAngle],CarInfoOrg[dir][CarModel],60000); INI_Close(ini); } count++; }
Код:
public LoadCars(); { new count = 0; while(count >= 0) { new dir[56] = "/Orgs/OrgFBI/Cars/.ini"; new count_string[32]; valstr(count_string, count); strins(dir, count_string, 20); INI_Load(dir); new INI:ini = INI_Open(dir); CarInfoOrg[CarCordx] = INI_Float(ini,"Cordx"); CarInfoOrg[CarCordy] = INI_Float(ini,"Cordy"); CarInfoOrg[CarCordz] = INI_Float(ini,"Cordz"); CarInfoOrg[CarAngle] = INI_Float(ini,"Angle"); CarInfoOrg[CarModel] = INI_Int(ini, "Model"); INI_Close(ini); count++; } return 1; }