Jump to content
  • 0

Problema gangzone-uri


Nightkill

Question

Problema intalnita (descriere): De cateva zile lucrez la un sistem dinamic de factiuni, sa poata jucatorii sa-si creeze propriile factiuni. Cand dau /createfaction totul merge ok si apare turf-ul dar daca opresc si repornesc serverul sau restart nu mai apar deloc gangzone-urile.
Ero(area / rile) / warning-(ul / urile): Nu am erori
Liniile de cod / sursa / script-ul:

 

Sus de tot

#define MAX_TERITORIES             500
forward OnTurfsLoad(playerid);
enum TDATA
{
    tid,
    tfaction,
    tcolor[16],
    Float:tfminx,
    Float:tfminy,
    Float:tfmaxx,
    Float:tfmaxy
}
new tInfo[MAX_TERITORIES][TDATA];

Ongamemodeinit

new zone[MAX_TERITORIES];
for(new i; i<2; i++) { zone = GangZoneCreate(tInfo[tfminx], tInfo[tfminy], tInfo[tfmaxx], tInfo[tfmaxy]); }

Onplayerspawn


new zone[MAX_TERITORIES];
for(new i; i<2; i++) { GangZoneShowForPlayer(playerid, zone, tInfo[tcolor]); }

Si in final public-ul


public OnTurfsLoad(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields, mysql);
    if(rows)
    {
        for (new i; i<cache_get_row_count(); i++)
        {
            tInfo[tid] = cache_get_field_content_int(i, "id");
            tInfo[tfaction] = cache_get_field_content_int(i, "faction");
            cache_get_field_content(i, "color", tInfo[tcolor], mysql, 16);
            tInfo[tfminx] = cache_get_field_content_float(i, "tfminx");
            tInfo[tfminy] = cache_get_field_content_float(i, "tfminy");
            tInfo[tfmaxx] = cache_get_field_content_float(i, "tfmaxx");
            tInfo[tfmaxy] = cache_get_field_content_float(i, "tfmaxy");
        }
    }
    printf("Number of existing turfs: %d", cache_get_row_count());
    return 1;
}

Imagini / Video (optional): Nu este cazul
Ati incercat sa rezolvati singur?: Da, am incercat si inca mai incerc

 

Care este faza care ma intriga foarte tare: Query-ul merge foarte bine, adica se face selectul si toate variabilele daca le dau cu printf mi le arata cum trebuie atata doar ca desi totul este la locul lui(dupa mintea mea) nu apar gangzone-urile. Poate voi baieti va dati seama unde gresesc eu sau ce fac aiurea. Poate nu pun ceva unde trebuie. Am incercat deja sa mut gangzonecreate si gangzoneshow prin diverse locuri gen onplayerconnect, ongamemodeinit si nici o schimbare. Daca pun dupa wiki cu new gangzone si ongamemodeinit create si niste coordonate si dupa onplayerspawn ii dau show merge fara probleme.

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

Turf save? :D Unde este?

 

Si la on player connect ai pus sa arate zona?

Edited by Ph0eniX
public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

  • 0

GangZoneShowForPlayer(playerid,[GangZone],[Culoare]);

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

  • 0

Salut nu sunt expert dar la

for(new i; i<2; i++)

nu trebuia sa fie

for(new i; i<MAX_TERITORIES; i++)

?

 

Ba da dar sunt doar 2 teritorii si am vrut sa fac de test momentan sa vad ca merge.

 

 

 

I-a arata-mi ce ai pus la OnPlayerSpawn .

for(new i; i<2; i++) { GangZoneShowForPlayer(playerid, zone, tInfo[tcolor]); }

Scrie si sus de tot in primul post din topic

Edited by Nightkill
Link to comment
Share on other sites

  • 0

Adica.... serios?! Baiatule, dupa ce un player isi creeaza o factiune si teritoriul respectiv, unde faci cu salvarea in fisier?

OFF: Adică...serios?! Băiatule, aşa vorbeşti tu cu membrii?

 

ON:

După include:

new zone[MAX_TERITORIES];

OnGameModeInit

for(new i=0; i<2; i++) { zone = GangZoneCreate(tInfo[tfminx], tInfo[tfminy], tInfo[tfmaxx], tInfo[tfmaxy]); }

OnPlayerSpawn

for(new i=0;i<2;i++) GangZoneShowForPlayer(playerid, zone,tInfo[tcolor]);

Şi , îţi arată măcar 1 teritoriu sau nici măcar unul?

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

  • 0

Am incercat cum ai zis tu Ph0eniX dar tot nu imi apar teritoriile.

 

@Sonny: Daca erai putin mai atent la ce am postat eu ar fi trebuit sa observi ca turf-urile le salvez si le incarc dintr-o baza de date, nu e nici un fisier(e invechita rau metoda asta si nu e prea eficienta, recurg la ea doar in cazul extrem in care chiar nu reusesc sa le fac sa apara din baza de date)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.