SA-MP Forums Archive
Need help with a textdraw, they seem to collide somehow. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with a textdraw, they seem to collide somehow. (/showthread.php?tid=276449)



Need help with a textdraw, they seem to collide somehow. - Intoxicated - 13.08.2011

Hello, I have a very weird problem in which a filterscript textdraw seems to be colliding with a textdraw from the main gamemode. I made a fuel FS which has a textdraw that is supposed to display the fuel, which it does fine, however instead of using the designated CreateTextDraw it seems to "steal" the faction message textdraw. I found this out when I tried moving the fuel display down a bit, and noticed it didn't move at all. When I editted the value for Y in the faction textdrawcreate, it did. I can't find out what is bugging them together, could someone please have a look?

Код:
forward Ftext(playerid, params[]);
fText[MAX_PLAYERS],

public OnPlayerSpawn(playerid)
{
	if(!IsLogged[playerid])
	{
	    SendClientMessage(playerid, COLOR_RED, "[System]: You aren't logged in!");
		Kick(playerid);
	}
	

	SetPlayerColor(playerid, 0xFEFEFEFF);
	if(IsAdmin(playerid))
	{
        SetPlayerColor(playerid, 0x05FF00FF);
	}

	RadioInfo[playerid][On]=0;
	RadioInfo[playerid][Freq]=1;


//	GivePlayerWeapon(playerid, 31, 500);
//	GivePlayerWeapon(playerid, 22, 100);
//	GivePlayerWeapon(playerid, 29, 230);
	if(!IsTutored(playerid))
	{
	    SetPlayerPos(playerid, 0,0,0);
	    TogglePlayerControllable(playerid,0);
	    SetPlayerCameraPos(playerid,-2690.1213,1934.1232,217.2739);
	    SetPlayerCameraLookAt(playerid, -2690.1213,1944.1232,217.2739);
	    SetPlayerVirtualWorld(playerid,1);
	    TutTimer[playerid] = SetTimerEx("tTimer", 1000, true, "i",playerid);
	}

	if(fInfo[playerid][Faction] == fCiv)
	{
	    SetPlayerSkin(playerid, 101);
	    GivePlayerWeapon(playerid, 25, 35);
	    GivePlayerWeapon(playerid, 24, 120);
	    SetPlayerPos(playerid, -2244.7727,2300.4060,4.9690);
	    SpawnText(playerid);

	}
	else if(fInfo[playerid][Faction] == fUSMC)
	{
	    SetPlayerSkin(playerid, 287);
	    GivePlayerWeapon(playerid, 31, 500);
		GivePlayerWeapon(playerid, 4, 1);
		GivePlayerWeapon(playerid, 22, 60);
		SetPlayerPos(playerid, -2235.1248,2327.8430,7.5469);
		SpawnText(playerid);
	}
	else if(fInfo[playerid][Faction] == fENF)
 	{
 	    SetPlayerSkin(playerid, 285);
 	    GivePlayerWeapon(playerid, 31, 500);
 	    GivePlayerWeapon(playerid, 23, 60);
 	    GivePlayerWeapon(playerid, 4, 1);
 	    GivePlayerWeapon(playerid, 34, 10);
 	    
 	    SetPlayerPos(playerid, -2843.7117,2710.8069,237.5147);
		SpawnText(playerid);
	}
}

//--------------Spawn Textdraws and Timers---------------------------------



stock SpawnText(playerid)
{
	if(timerrunning[playerid])
	{
	    KillTimer(fText[playerid]);
	    TextDrawHideForPlayer(playerid, tFaction[playerid]);
	    timerrunning[playerid]=0;
	}
	if(!timerrunning[playerid])
	{
		new
	    	string[128];
		format(string,sizeof(string), "%s",GetFactionName(playerid));
	    tFaction[playerid] = TextDrawCreate(320.0, 120.00,string);
		TextDrawAlignment(tFaction[playerid], 2);
		TextDrawFont(tFaction[playerid], 1);
		TextDrawSetProportional(tFaction[playerid] , 1);
		TextDrawLetterSize(tFaction[playerid] , 1, 2);
		TextDrawColor(tFaction[playerid], GetFactionColor(playerid));
		TextDrawShowForPlayer(playerid, tFaction[playerid]);
		TextDrawSetShadow(tFaction[playerid] , 1);
		timerrunning[playerid]=1;
		fText[playerid] = SetTimerEx("Ftext",10000, false,"i",playerid);
	}
		
/*
text = TextDrawCreate(214, 144, "usmc");
TextDrawFont(text , 3);
TextDrawLetterSize(text , 12, 84);
TextDrawColor(text , 0x0000FFFF);
TextDrawSetOutline(text , 1);
TextDrawSetProportional(text , 1);
TextDrawSetShadow(text , 1);
*/
}

public Ftext(playerid, params[])
{
    TextDrawHideForPlayer(playerid, tFaction[playerid]);
    timerrunning[playerid]=0;
    return 1;
}
And the code from the FS:

http://pastebin.com/1Zhsuxjj

Please help me!

EDIT: Please note that the identation is off because of the forum/pastebin.


Re: Need help with a textdraw, they seem to collide somehow. - Intoxicated - 14.08.2011

Problem persists, even when I COMMENT the textdraw lines in the main gamemode, the FS STILL uses it.