Jump to content
  • 0

Problema LoadGraffiti


draken

Question

Salutare dragi prieteni ! In cele ce urmeaza am sa va prezint problema mea.

Am implementat recent in gamemode un sistem de clan turfs [/spay]. Totul decurge perfect, ma pun duty, merg la peretele unde este "turful", folosesc spray, se pune text-ul[tag-ul clanului], dau restart la server, ma duc la peretele pe care l-am "dominat" inainte de restart, peretele figureaza ca fiind al clanului din care fac parte dar pe perete se pun niste paranteze " {} ". Va pun in cele ce urmeaza LoadGraffiti si FinalProcess(atunci cand pune text-ul pe perete, cand functioneaza pana sa dau restart la server).

LoadGraffiti:

public LoadGraffiti()
{
	new Cache: db = mysql_query(SQL, "SELECT * FROM `graffiti` ORDER BY `graffiti`.`ID` ASC");
	new graff = 0, x, result[256], tagname[256];
 	for(new i, j = cache_get_row_count (); i != j; ++i)
	{
	    graff ++;
       	cache_get_field_content(i, "ID", result); x = strval(result); GraffitiInfo[x][gfID] = x;
       	cache_get_field_content(i, "X", result); GraffitiInfo[x][gfX] = floatstr(result);
       	cache_get_field_content(i, "Y", result); GraffitiInfo[x][gfY] = floatstr(result);
     	cache_get_field_content(i, "Z", result); GraffitiInfo[x][gfZ] = floatstr(result);
      	cache_get_field_content(i, "Rot", result); GraffitiInfo[x][gfRot] = floatstr(result);
       	cache_get_field_content(i, "Owned", result); GraffitiInfo[x][gfOwned] = strval(result);
       	cache_get_field_content(i, "Tag", result); GraffitiInfo[x][gfTag] = strval(result);
       	cache_get_field_content(i, "Color", result); GraffitiInfo[x][gfColor] = strval(result);

	    GraffitiInfo[x][gfObject] = CreateDynamicObject(19373, GraffitiInfo[x][gfX], GraffitiInfo[x][gfY], GraffitiInfo[x][gfZ], 0.0, 0.0, GraffitiInfo[x][gfRot]);
	    if(GraffitiInfo[x][gfOwned] == 0 ) tagname = "None";
	    else format(tagname, sizeof(tagname), "{%s}%s", ClanInfo[GraffitiInfo[x][gfOwned]][cClanColor], ClanInfo[GraffitiInfo[x][gfOwned]][cClanTag]);
	    SetDynamicObjectMaterialText(GraffitiInfo[x][gfObject], 0, tagname, OBJECT_MATERIAL_SIZE_256x128, "BankGothic Md BT", 60, 1, 0xfff0f0f0, 0, 1);
	}
	printf("[Graffiti Script]: %d graffiti loaded.", graff);
	cache_delete(db);
	return 1;
}

Si FinalProcess:

public FinalProces(playerid) {
	if(IsPlayerConnected(playerid) && StartedSpray[playerid] == 1) {
    	ClearAnimations(playerid);
    	new string[256];
    	new string1[256];
    	new test = 7 + random(6);
    	ClanProces[playerid] += test;
    	if(ClanProces[playerid] >= 100) {
			new tagname[256];
			new i = StartedSprayOn[playerid];
			format(string, sizeof(string), "{FF0000}%s (din clanul %s) a reusit sa va deseneze complet peretele (turf id %d).", GetName(playerid), ClanInfo[PlayerInfo[playerid][pClan]][cClanName], i);
			SendClanMessage(GraffitiInfo[i][gfOwned], string);
			format(string, sizeof(string), "{FF0000}%s a reusit sa va deseneze complet peretele (turf id %d).", GetName(playerid), i);
			SendClanMessage(PlayerInfo[playerid][pClan], string);
            GraffitiInfo[i][gfOwned] = PlayerInfo[playerid][pClan];
			DestroyDynamicObject(GraffitiInfo[i][gfObject]);
			GraffitiInfo[i][gfObject] = CreateDynamicObject(19373, GraffitiInfo[i][gfX], GraffitiInfo[i][gfY], GraffitiInfo[i][gfZ], 0.0, 0.0, GraffitiInfo[i][gfRot]);
			format(tagname, sizeof(tagname), "{%s}%s", ClanInfo[GraffitiInfo[i][gfOwned]][cClanColor], ClanInfo[GraffitiInfo[i][gfOwned]][cClanTag]);
		    SetDynamicObjectMaterialText(GraffitiInfo[i][gfObject], 0, tagname, OBJECT_MATERIAL_SIZE_256x128, "BankGothic Md BT", 60, 1, 0xfff0f0f0, 0, 1);
			GraffitiInfo[StartedSprayOn[playerid]][gfAttacked] = 0;
			new query[256];
			format(query, sizeof(query), "UPDATE `graffiti` SET `Owned`='%d' WHERE `ID`='%d'", PlayerInfo[playerid][pClan], i);
			mysql_query(SQL, query);
			StartedSpray[playerid] = 0;
			StartedSpray2[playerid] = 0;
			StartedSprayOn[playerid] = 0;
    	}
    	else {
	    	format(string, sizeof(string), "{F29C55}Continua sa dai cu spray-ul! (%d%s)", ClanProces[playerid], "%%");
			format(string1, sizeof(string1), "~r~Progres~n~~w~%d%s", ClanProces[playerid], "%");
			GameTextForPlayer(playerid, string1, 5000, 1);
			SendClientMessage(playerid, -1, string);
    	}
    	ResetPlayerWeapons(playerid);
    	StartedSpray2[playerid] = 0;
	}
	return 1;
}

Va rog frumos sa ma ajutati.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0
public LoadGraffiti()
{
	new Cache: db = mysql_query(SQL, "SELECT * FROM `graffiti` ORDER BY `graffiti`.`ID` ASC");
	new tagname[256];
  
 	for(new i, j = cache_get_row_count(); i < j; ++i)
	{
       	GraffitiInfo[j][gfID]    = cache_get_field_content_int(i, "ID",);
       	GraffitiInfo[j][gfX]     = cache_get_field_content_float(i, "X");
       	GraffitiInfo[j][gfY]     = cache_get_field_content_float(i, "Y");
     	GraffitiInfo[j][gfZ]     = cache_get_field_content_float(i, "Z");
      	GraffitiInfo[j][gfRot]   = cache_get_field_content_float(i, "Rot");
       	GraffitiInfo[j][gfOwned] = cache_get_field_content(i, "Owned", 64);
       	GraffitiInfo[j][gfTag]   = cache_get_field_content(i, "Tag", 64);
       	GraffitiInfo[j][gfColor] = cache_get_field_content(i, "Color", 32);

	    GraffitiInfo[x][gfObject] = CreateDynamicObject(19373, GraffitiInfo[j][gfX], GraffitiInfo[j][gfY], GraffitiInfo[j][gfZ], 0.0, 0.0, GraffitiInfo[j][gfRot]);
	    if(GraffitiInfo[j][gfOwned] == 0)
          	tagname = "None";
	    else 
          	format(tagname, sizeof(tagname), "{%s}%s", ClanInfo[GraffitiInfo[j][gfOwned]][cClanColor], ClanInfo[GraffitiInfo[j][gfOwned]][cClanTag]);
	    SetDynamicObjectMaterialText(GraffitiInfo[j][gfObject], 0, tagname, OBJECT_MATERIAL_SIZE_256x128, "BankGothic Md BT", 60, 1, 0xfff0f0f0, 0, 1);
	}
	printf("[Graffiti Script]: %d graffiti loaded.", cache_get_row_count());
  	print("Debug:");
  	printf("ID: %d | Owned: %s | Tag: %s | Color %s", GraffitiInfo[j][gfID], GraffitiInfo[j][gfOwned], GraffitiInfo[j][gfTag], GraffitiInfo[j][gfColor]); 
	cache_delete(db);
	return 1;
}

 

  • Upvote 1
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.