Textdraw not working! -
Chrillzen - 07.11.2013
Hi guys, I've been tackling this since yesterday and I just can't get it to work.... Whenever I enter the area it shows the textdraw but then it hides it and it repeats that all the time.. making the textdraw flash/flicker. I don't want the textdraw to hide all the time I just want it to hide whenever the players leaves the area. I've tried many different methods.. timers, onplayerpickuppickup.. always the same problem.
Here's my code, someone PLEASE help me.
pawn Код:
public OnPlayerUpdate(playerid)
{
for(new b = 1; b < sizeof(BusinessInfo); b++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.5, BusinessInfo[b][bEntranceX],BusinessInfo[b][bEntranceY], BusinessInfo[b][bEntranceZ])) // coords of your pickup
{
pickedUp[ playerid ] = true;
}
else if(!IsPlayerInRangeOfPoint(playerid, 1.5, BusinessInfo[b][bEntranceX],BusinessInfo[b][bEntranceY], BusinessInfo[b][bEntranceZ])) // same here
{
pickedUp[ playerid ] = false;
TextDrawHideForPlayer(playerid,Textdraw0);
TextDrawHideForPlayer(playerid,Textdraw1);
TextDrawHideForPlayer(playerid,Textdraw2);
TextDrawHideForPlayer(playerid,Textdraw3);
TextDrawHideForPlayer(playerid,Textdraw5);
TextDrawHideForPlayer(playerid,Textdraw4);
TextDrawHideForPlayer(playerid,Textdraw6);
TextDrawHideForPlayer(playerid,Textdraw7);
TextDrawHideForPlayer(playerid,Textdraw8);
TextDrawHideForPlayer(playerid,Textdraw9);
TextDrawHideForPlayer(playerid,Textdraw10);
TextDrawHideForPlayer(playerid,Textdraw11);
TextDrawHideForPlayer(playerid,Textdraw12);
TextDrawHideForPlayer(playerid,Textdraw13);
}
}
return 1;
}
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
new string[256];
for(new b = 1;b < sizeof(BusinessInfo);b++)
{
if(pickupid == BusinessInfo[b][bOutsideIcon])
{
if( pickedUp [ playerid ] == true ) return false;
if(BusinessInfo[b][bOwned] == 0)
{
pickedUp[ playerid ] = true;
format(string, sizeof(string), "%s", BusinessType(b));
TextDrawSetString(Textdraw7, string);
format(string, sizeof(string), "%s", BusinessInfo[b][bName]);
TextDrawSetString(Textdraw6, string);
format(string, sizeof(string), "%d", BusinessInfo[b][bPrice]);
TextDrawSetString(Textdraw8, string);
format(string, sizeof(string), "%i", b);
TextDrawSetString(Textdraw9, string);
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
TextDrawShowForPlayer(playerid,Textdraw3);
TextDrawShowForPlayer(playerid,Textdraw4);
TextDrawShowForPlayer(playerid,Textdraw6);
TextDrawShowForPlayer(playerid,Textdraw7);
TextDrawShowForPlayer(playerid,Textdraw8);
TextDrawShowForPlayer(playerid,Textdraw9);
TextDrawShowForPlayer(playerid,Textdraw10);
TextDrawShowForPlayer(playerid,Textdraw12);
TextDrawShowForPlayer(playerid,Textdraw13);
}
if(BusinessInfo[b][bOwned] == 1)
{
pickedUp[ playerid ] = true;
format(string, sizeof(string), "%s", BusinessType(b));
TextDrawSetString(Textdraw7, string);
format(string, sizeof(string), "%s", BusinessInfo[b][bName]);
TextDrawSetString(Textdraw6, string);
format(string, sizeof(string), "%d", BusinessInfo[b][bPrice]);
TextDrawSetString(Textdraw8, string);
format(string, sizeof(string), "%i", b);
TextDrawSetString(Textdraw9, string);
format(string, sizeof(string), "%s", BusinessInfo[b][bOwner]);
TextDrawSetString(Textdraw11, string);
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
TextDrawShowForPlayer(playerid,Textdraw3);
TextDrawShowForPlayer(playerid,Textdraw4);
TextDrawShowForPlayer(playerid,Textdraw6);
TextDrawShowForPlayer(playerid,Textdraw7);
TextDrawShowForPlayer(playerid,Textdraw8);
TextDrawShowForPlayer(playerid,Textdraw9);
TextDrawShowForPlayer(playerid,Textdraw10);
TextDrawShowForPlayer(playerid,Textdraw11);
TextDrawShowForPlayer(playerid,Textdraw5);
}
}
}
return 1;
}
Re: Textdraw not working! -
ToiletDuck - 07.11.2013
remove the code under your OnplayerUpdate, Not Tested
pawn Код:
//put this under OnGameModeInit
SetTimer("HideBizTextDraw",1000,1); // updates every 1 second > 1000 miliseconds
forward HideBizTextDraw(playerid);
public HideBizTextDraw(playerid)
{
for(new b = 1; b < sizeof(BusinessInfo); b++)
{
if(!IsPlayerInRangeOfPoint(playerid, 1.5, BusinessInfo[b][bEntranceX],BusinessInfo[b][bEntranceY], BusinessInfo[b][bEntranceZ])) // coords of your pickup
{
TextDrawHideForPlayer(playerid,Textdraw0);
TextDrawHideForPlayer(playerid,Textdraw1);
TextDrawHideForPlayer(playerid,Textdraw2);
TextDrawHideForPlayer(playerid,Textdraw3);
TextDrawHideForPlayer(playerid,Textdraw5);
TextDrawHideForPlayer(playerid,Textdraw4);
TextDrawHideForPlayer(playerid,Textdraw6);
TextDrawHideForPlayer(playerid,Textdraw7);
TextDrawHideForPlayer(playerid,Textdraw8);
TextDrawHideForPlayer(playerid,Textdraw9);
TextDrawHideForPlayer(playerid,Textdraw10);
TextDrawHideForPlayer(playerid,Textdraw11);
TextDrawHideForPlayer(playerid,Textdraw12);
TextDrawHideForPlayer(playerid,Textdraw13);
}
}
return 1;
}
Re: Textdraw not working! -
Pottus - 07.11.2013
Here is what I would do....
1.) Get rid of OnPlayerUpdate()
2.) Create a timer (HideTimer)
3.) Add a new variable (pickedUpTime[MAX_PLAYERS])
4.) Do this
pawn Код:
// OnGameModeInit()
SetTimer("HideTimer", 3000, true);
// OnPlayerPickUpDynamicPickup(playerid, pickupid)
if( pickedUp [ playerid ] == true )
{
pickedUpTime[playerid] = GetTickCount();
return false;
}
forward HideTimer();
public HideTimer()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(!pickedUp [ playerid ]) continue;
// No pickup in 5 seconds? Hide textdraws
if(GetTickCount() - pickedUpTime[playerid] < 5000)
{
}
}
}
Then here
if(BusinessInfo[b][bOwned] == 0)
{
pickedUp[ playerid ] = true;
pickedUpTime[playerid] = GetTickCount();
and here
if(BusinessInfo[b][bOwned] == 1)
{
pickedUp[ playerid ] = true;
pickedUpTime[playerid] = GetTickCount();
@Edit the reason why this won't work'
pawn Код:
for(new b = 1; b < sizeof(BusinessInfo); b++)
{
if(!IsPlayerInRangeOfPoint(playerid, 1.5, BusinessInfo[b][bEntranceX],BusinessInfo[b][bEntranceY], BusinessInfo[b][bEntranceZ])) // coords of your pickup
{
Very obvious you would need to check the current business not all businesses
Re: Textdraw not working! -
Chrillzen - 07.11.2013
Not working, it flashes one time and then even if I re-enter the area nothing shows up.
EDIT: hold on, testin pottus version.
Re: Textdraw not working! -
Chrillzen - 07.11.2013
What am I doing wrong, lol...

I'm way out here and I don't really know what I am doing anymore, lol.
pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
new
id = IsPlayerNearBizEnt(playerid);
if( pickedUp[playerid] == true )
{
pickedUpTime[playerid] = GetTickCount();
return false;
}
if(BusinessInfo[id][bOwned] == 0)
{
pickedUp[playerid] = true;
format(string, sizeof(string), "%s", BusinessType(id));
TextDrawSetString(Textdraw7, string);
format(string, sizeof(string), "%s", BusinessInfo[id][bName]);
TextDrawSetString(Textdraw6, string);
format(string, sizeof(string), "%d", BusinessInfo[id][bPrice]);
TextDrawSetString(Textdraw8, string);
format(string, sizeof(string), "%i", id);
TextDrawSetString(Textdraw9, string);
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
TextDrawShowForPlayer(playerid,Textdraw3);
TextDrawShowForPlayer(playerid,Textdraw4);
TextDrawShowForPlayer(playerid,Textdraw6);
TextDrawShowForPlayer(playerid,Textdraw7);
TextDrawShowForPlayer(playerid,Textdraw8);
TextDrawShowForPlayer(playerid,Textdraw9);
TextDrawShowForPlayer(playerid,Textdraw10);
TextDrawShowForPlayer(playerid,Textdraw12);
TextDrawShowForPlayer(playerid,Textdraw13);
}
if(BusinessInfo[id][bOwned] == 1)
{
pickedUp[playerid] = true;
format(string, sizeof(string), "%s", BusinessType(id));
TextDrawSetString(Textdraw7, string);
format(string, sizeof(string), "%s", BusinessInfo[id][bName]);
TextDrawSetString(Textdraw6, string);
format(string, sizeof(string), "%d", BusinessInfo[id][bPrice]);
TextDrawSetString(Textdraw8, string);
format(string, sizeof(string), "%i", id);
TextDrawSetString(Textdraw9, string);
format(string, sizeof(string), "%s", BusinessInfo[id][bOwner]);
TextDrawSetString(Textdraw11, string);
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
TextDrawShowForPlayer(playerid,Textdraw3);
TextDrawShowForPlayer(playerid,Textdraw4);
TextDrawShowForPlayer(playerid,Textdraw6);
TextDrawShowForPlayer(playerid,Textdraw7);
TextDrawShowForPlayer(playerid,Textdraw8);
TextDrawShowForPlayer(playerid,Textdraw9);
TextDrawShowForPlayer(playerid,Textdraw10);
TextDrawShowForPlayer(playerid,Textdraw11);
TextDrawShowForPlayer(playerid,Textdraw5);
}
return 1;
}
pawn Код:
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5355) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5358) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5360) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5361) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5362) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5363) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5364) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5365) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5366) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5367) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5368) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5369) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5370) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5371) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5372) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5373) : error 017: undefined symbol "playerid"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5391) : error 017: undefined symbol "string"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5391) : error 017: undefined symbol "string"
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5391) : error 029: invalid expression, assumed zero
C:\Users\Juha Stenius\Desktop\Allt\SERVER\gamemodes\IllusionalRP.pwn(5391) : fatal error 107: too many error messages on one line