Dinamicno kreiranje GPS


Započeo ᴄ ᴀ ꜱ ᴛ ᴇ ʟ ʟ ᴏ, Avgust 26, 2020, 12:20:06 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Problem(error/warning): Imam problem kad kreiram gps na server i sve norm radi ali posle restarta kad idem /gps pise da nema kreiranih gps lokacija https://imgur.com/l1Z4Fpk
Deo skripte:
stock GpsFilePath(i)
{
	new pFile[40];

	format(pFile, sizeof(pFile), GPS_PATH, i);
	return pFile;
}

stock LoadGpss()
{
	for(new i = 0; i < MAX_GPS_LOCATIONS; i++)
	{
		if(fexist(GpsFilePath(i)))
		{
		    INI_ParseFile(GpsFilePath(i), "Loadgps_PF", .bExtra = true, .extra = i);
		    GpsLocations = (i+1);
		}
	}

	printf("Ukupno kreiranih gps lokacija je > [%d]...", GpsLocations);
	return 1;
}

stock SaveGPSLocation(id)
{
 	new INI:file = INI_Open(GpsFilePath(id)); 

  	INI_WriteBool(file,"Created", gps_Data[id][gps_Created]);
  	INI_WriteString(file,"Name",gps_Data[id][gps_LocationName]);
  	INI_WriteFloat(file,"X",gps_Data[id][gps_Pos][0]);
  	INI_WriteFloat(file,"Y",gps_Data[id][gps_Pos][1]);
  	INI_WriteFloat(file,"Z",gps_Data[id][gps_Pos][2]);
  	INI_WriteFloat(file,"A",gps_Data[id][gps_Pos][3]);
  	INI_WriteInt(file,"Typ",gps_Data[id][gps_Type]);
  	INI_Close(file);
	return 1;
}

stock Loadgps_PF(id, name[], value[])
{
	INI_Bool("Created", gps_Data[id][gps_Created]);
	INI_String("Name", gps_Data[id][gps_LocationName],30);
 	INI_Float("X", gps_Data[id][gps_Pos][0]);
  	INI_Float("Y", gps_Data[id][gps_Pos][1]);
  	INI_Float("Z", gps_Data[id][gps_Pos][2]);
  	INI_Float("A", gps_Data[id][gps_Pos][3]);
  	INI_Int("Typ",gps_Data[id][gps_Type]);
  	return 1;
}

CMD:creategps(playerid, params[])
{
	if(PI[playerid][pAdmin] < 6) return Error(playerid, "Ne mozes to");
	
	if(GpsLocations >= MAX_GPS_LOCATIONS) {
		new bool:freeslot = false;
		for(new i = 0; i < GpsLocations; i++) {
			if(gps_Data[i][gps_Created] == false) {
				freeslot = true;
				break;
			}
		}
		if(freeslot == false) return Error(playerid, "Maksimalni broj gps lokacija je vec kreiran!");
	}
	new string[562];
	format(string, 562, "{327EFF}Dostupne kategorije: \n\n{327EFF}1# "col_white"Beograd\n{327EFF}2# "col_white"Zagreb\n{327EFF}3# "col_white"Sarajevo\n\
		{327EFF}4# "col_white"Posao\n{327EFF}5# "col_white"Organizacija\n{327EFF}6# "col_white"Ostalo\n\nUnesite {327EFF}kategorija i ime gps lokacije "col_white"da kreirate novu gps lokaciju:");

	SPD(playerid, DIALOG_CREATE_GPS, DIALOG_STYLE_INPUT, COL_BE "Kreiranje gps lokacije:", string, "Dalje", "Prekid");
	dialogData[playerid][0] = 1;
	return 1;
}

CMD:editgps(playerid, params[])
{
	if(PI[playerid][pAdmin] < 6) return Error( playerid, "Nemate ovlastenje za koriscenje ove komande!");
	
	if(GpsLocations <= 0) return Error(playerid, "Nema kreiranih gps lokacija!");
	SPD(playerid, DIALOG_EDIT_GPS, DIALOG_STYLE_INPUT,  "Uredivanje gps lokacije:", COL_WHITE "Unesite "COL_YELLOW"ID lokacije (/gpslist)"col_white" da uredite gps lokaciju:", "Dalje", "Prekid");
	dialogData[playerid][0] = 1;
	return 1;
}

CMD:gps(playerid, params[])
{
	if(PI[playerid][pJailed] > 0) return Error(playerid, "Ne mozes ovde!");
	if(Tazovan[playerid] > 0 || Zavezan[playerid] > 0 || Tie[playerid] > 0) return Error(playerid, "Ne mozes to, zavezan/sokiran si!");
	if(RentAuto(GetPlayerVehicleID(playerid)) && Rentao[playerid] == 9999 && GetPlayerState(playerid) == PL_ST_DRIVER) return Error(playerid, "Ne mozes da radis BA!");
	SPD(playerid, DIALOG_GPS_TYPS, DIALOG_STYLE_LIST, ""col_white"Port Kategorije", "{327EFF}01: "col_white"BEOGRAD\n{327EFF}02: "col_white"ZAGREB\n{327EFF}03: "col_white"SARAJEVO\n{327EFF}04: "col_white"POSLOVI\n{327EFF}05: "col_white"ORGANIZACIJE\n{327EFF}06: "col_white"OSTALO", "Odaberi", "Ponisti");
	new mrk[128];
    format(mrk, sizeof(mrk), "* %s otvara meni GPS-a.", GetName(playerid));
	ProxDetector(30.0, playerid, mrk, PURPLE1,PURPLE2,PURPLE3,PURPLE4,PURPLE5);
	return 1;
}

CMD:gpslist(playerid, params[])
{
	
	if(PI[playerid][pAdmin] < 5) return Error(playerid, "Ne mozes to");

	SPD(playerid, DIALOG_GPS_LIST, DIALOG_STYLE_LIST, ""col_white"GPS", "{327EFF}01: "col_white"BEOGRAD\n{327EFF}02: "col_white"ZAGREB\n{327EFF}03: "col_white"SARAJEVO\n{327EFF}04: "col_white"POSLOVI\n{327EFF}05: "col_white"ORGANIZACIJE\n{327EFF}06: "col_white"OSTALO", "Odaberi", "Ponisti");
	return 1;
}

stock GetGPSIDFromName(type, id, name[])//Samo za dialog
{
	for(new i = 0; i <= MAX_GPS_LOCATIONS; i++)
  	{
  		new fullname[126];
		format(fullname,sizeof(fullname), "%02d: %s", id, gps_Data[i][gps_LocationName]);
    	if(strcmp(fullname, name, true, strlen(name)) == 0)
    	{
    		if(gps_Data[i][gps_Type] == type) 
    		{
        		return i;
        	}
    	}
  	}
  	return INVALID_PLAYER_ID;
}

stock getGPSTypeFromID(type)
{
	new string[128] = "Nepoznato";
	switch(type)
	{
		case 01: string = "Beograd";
		case 02: string = "Zagreb";
		case 03: string = "Sarajevo";
		case 04: string = "Posao";
		case 05: string = "Organizacija";
		case 06: string = "Ostalo";
	}
	return string;
}
#define MAX_GPS_LOCATIONS		300
#define GPS_PATH				"Emirates/gps/%d.ini"

enum gps_data {
	bool:gps_Created,
	gps_LocationName[30],
	Float:gps_Pos[4],
	gps_Type
}
new gps_Data[MAX_GPS_LOCATIONS][gps_data],
	GpsLocations = 0;

Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log):
Vaš odgovor

Kada kreiras/izmenis gps port moras pozvati sledecu funkciju: SaveGPSLocation(id)
Those parts of the system that you can hit with a hammer (not advised) are called hardware; those program instructions that you can only curse at are called software

Pa kreiraj ih ?  :D


NAJTAN IN HOUSE ! - PROFI TROLLER , PROFI MIRODJIJA !
JEDAN JEDINI PRODRAMER !
PRODRAMER JE PROFI LICE KOJE PRAVI DRAME KAKO BI SE ZABAVILO JER MU JE DOSADNO NAMERNO PRAVI GRESKE I JEBE MU SE STA DRUGI MISLE JER CEKA DA MU BAN ISTEKNE NA DRUGOM PROFILU !