SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 07/11/2016, 08:17 PM   #1
XBoss30
Banned
 
Join Date: Oct 2016
Location: 127.0.0.1
Posts: 51
Reputation: 15
Default Text Draw's are not hidding/destroying

When I want to spawn I want a Text Draw to get hidden so I did this:

On top of the filterscript:
PHP Code:
new Text:XBoss30
Under public OnPlayerSpawn(playerid):
PHP Code:
public OnPlayerSpawn(playerid)
{
    
TextDrawHideForPlayer(playeridXBoss30);
    return 
1;

And under public OnGameModeInIt():
PHP Code:
 XBoss30 TextDrawCreate(641.500000449.062500"usebox");
    
TextDrawLetterSize(XBoss300.000000, -13.879164);
    
TextDrawTextSize(XBoss30, -2.0000000.000000);
    
TextDrawAlignment(XBoss301);
    
TextDrawColor(XBoss30255);
    
TextDrawUseBox(XBoss30true);
    
TextDrawBoxColor(XBoss30255);
    
TextDrawSetShadow(XBoss300);
    
TextDrawSetOutline(XBoss300);
    
TextDrawBackgroundColor(XBoss30255);
    
TextDrawFont(XBoss300);
    
TextDrawSetProportional(XBoss301); // Bottom Black Bar 
Still this TextDraw is being displayed when i run it and spawn.
Any Help? NewBie Here

Last edited by XBoss30; 07/11/2016 at 08:20 PM. Reason: ~ Updated
XBoss30 is offline   Reply With Quote
Old 07/11/2016, 08:23 PM   #2
XBoss30
Banned
 
Join Date: Oct 2016
Location: 127.0.0.1
Posts: 51
Reputation: 15
Default Re: Text Draw's are not hidding/destroying

Quote:
Originally Posted by TopShooter View Post
You defined the textdraw as "XBoss", you got to use this definition in the PlayerTextDrawDestroy function aswell.

PHP Code:
public OnPlayerSpawn(playerid)

    
PlayerTextDrawHide(playeridXBoss);
    return 
1;

I defined It as "XBoss30" and I use the definition in TextDrawHideForPlayer function.
XBoss30 is offline   Reply With Quote
Old 07/11/2016, 09:00 PM   #3
Jelly23
Guest
 
Posts: n/a
Default Re: Text Draw's are not hidding/destroying

Quote:
Originally Posted by TopShooter View Post
Sorry, didn't really read your whole post properly since I was in a hurry.

Try using [MAX_PLAYERS].


PHP Code:
    new Text:XBoss30[MAX_PLAYERS];


    public 
OnPlayerSpawn(playerid) {
    
TextDrawHideForPlayer(playeridXBoss30[playerid]);
    return 
1;
    }

    public 
OnGameModeInit() {
    
XBoss30[playerid] = TextDrawCreate(641.500000449.062500"usebox"); 
    
TextDrawLetterSize(XBoss30[playerid], 0.000000, -13.879164); 
    
TextDrawTextSize(XBoss30[playerid], -2.0000000.000000); 
    
TextDrawAlignment(XBoss30[playerid], 1); 
    
TextDrawColor(XBoss30[playerid], 255); 
    
TextDrawUseBox(XBoss30[playerid], true); 
    
TextDrawBoxColor(XBoss30[playerid], 255); 
    
TextDrawSetShadow(XBoss30[playerid], 0); 
    
TextDrawSetOutline(XBoss30[playerid], 0); 
    
TextDrawBackgroundColor(XBoss30[playerid], 255); 
    
TextDrawFont(XBoss30[playerid], 0); 
    
TextDrawSetProportional(XBoss30[playerid], 1);
    return 
1;
    } 
That's bad, you shouldn't use global textdraws as player textdraws.
  Reply With Quote
Old 07/11/2016, 09:00 PM   #4
Magic11
Banned
 
Join Date: Oct 2015
Location: Brazil
Posts: 99
Reputation: 10
Default Re: Text Draw's are not hidding/destroying

Use TextDrawShowForPlayer under OnPlayerConnect.

It should work now.
Magic11 is offline   Reply With Quote
Old 08/11/2016, 03:15 PM   #5
XBoss30
Banned
 
Join Date: Oct 2016
Location: 127.0.0.1
Posts: 51
Reputation: 15
Default Re: Text Draw's are not hidding/destroying

I'm getting a whole bunch of errors saying:
PHP Code:
error 017undefined symbol "playerid" 
and everything is set as you mentioned above, Fuuuck! [Saying this in a nice way]
XBoss30 is offline   Reply With Quote
Old 08/11/2016, 04:12 PM   #6
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,694
Reputation: 571
Default Re: Text Draw's are not hidding/destroying

Quote:
Originally Posted by XBoss30 View Post
I'm getting a whole bunch of errors saying:
PHP Code:
error 017undefined symbol "playerid" 
and everything is set as you mentioned above, Fuuuck! [Saying this in a nice way]
The code made absolutely no sense.

A) There is no playerid parameter in OnGameModeInit.
B) You use a global TextDraw, not a per-player one. There is no point in using a per-player TextDraw if you want to show the same thing to everyone!

The code as such is correct! There must be a mistake somewhere else. Do you show/hide it somewhere else in the script? Does OnPlayerSpawn get called?
NaS is offline   Reply With Quote
Old 08/11/2016, 04:21 PM   #7
XBoss30
Banned
 
Join Date: Oct 2016
Location: 127.0.0.1
Posts: 51
Reputation: 15
Default Re: Text Draw's are not hidding/destroying

Quote:
Originally Posted by NaS View Post
The code made absolutely no sense.

A) There is no playerid parameter in OnGameModeInit.
B) You use a global TextDraw, not a per-player one. There is no point in using a per-player TextDraw if you want to show the same thing to everyone!

The code as such is correct! There must be a mistake somewhere else. Do you show/hide it somewhere else in the script? Does OnPlayerSpawn get called?
OnPlayerSpawn does get called and that's where "TextDrawShowForPlayer(playerid, XBoss30[playerid]" is ?!
When i made textdraws i always made it like this and it worked perfectly but i don't know whats the problem now
XBoss30 is offline   Reply With Quote
Old 08/11/2016, 07:42 PM   #8
Shaheen
Big Clucker
 
Shaheen's Avatar
 
Join Date: Feb 2016
Location: Qatar
Posts: 197
Reputation: 11
Default Re: Text Draw's are not hidding/destroying

try this
PHP Code:
public ongamemodeinit()
    
TextDrawShowForPlayer(playeridXBoss30[playerid]); 
    return 
1


and 
on 
public  onplayerspawn(playerid)

TextDrawHideForPlayer(playerid
XBoss30
[playerid]); 
it should work..
__________________
Payment : PayPal.Me/ShaheenMuhammed
My Whatsapp Number: +919995775938
Shaheen is offline   Reply With Quote
Old 08/11/2016, 07:50 PM   #9
MikeB
Banned
 
Join Date: Mar 2014
Posts: 59
Reputation: 10
Default Re: Text Draw's are not hidding/destroying

Quote:
Originally Posted by Shaheen View Post
try this
PHP Code:
public ongamemodeinit()
    
TextDrawShowForPlayer(playeridXBoss30[playerid]); 
    return 
1


and 
on 
public  onplayerspawn(playerid)

TextDrawHideForPlayer(playerid
XBoss30
[playerid]); 
it should work..
There's no playerid parameter on OnGameModeInit, do you have any idea of what you are doing? I guess not.
MikeB is offline   Reply With Quote
Old 08/11/2016, 07:55 PM   #10
Shaheen
Big Clucker
 
Shaheen's Avatar
 
Join Date: Feb 2016
Location: Qatar
Posts: 197
Reputation: 11
Default Re: Text Draw's are not hidding/destroying

Quote:
Originally Posted by MikeB View Post
There's no playerid parameter on OnGameModeInit, do you have any idea of what you are doing? I guess not.
bymistake
just make it in onplayerconnect instead of ongamemodeinit
__________________
Payment : PayPal.Me/ShaheenMuhammed
My Whatsapp Number: +919995775938
Shaheen is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic 3d text labels - issues destroying properly denNorske Scripting Help 4 11/03/2015 02:42 PM
Text draw shoaib_sait Scripting Help 0 10/02/2013 04:45 PM
Hidding the chat. GangsTa_ Client Support 2 22/01/2012 05:14 AM
[Help] Text Draw Help. [Comrade] Help Archive 4 16/12/2010 10:22 PM
[FilterScript] Text-Draw Box Awesome@Man Filterscripts 12 26/08/2010 03:55 PM


All times are GMT. The time now is 11:27 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.