new Text:intro; public OnFilterScriptInit() intro = TextDrawCreate(24.399976, 195.646636, "random"); TextDrawLetterSize(intro, 0.400000, 1.600000); TextDrawTextSize(intro, 639.000000, 0.000000); TextDrawAlignment(intro, 1); TextDrawColor(intro, -1); TextDrawUseBox(intro, 1); TextDrawBoxColor(intro, 255); TextDrawSetShadow(intro, 0); TextDrawSetOutline(intro, 0); TextDrawBackgroundColor(intro, 255); TextDrawFont(intro, 1); TextDrawSetProportional(intro, 1); TextDrawSetShadow(intro, 0); return 1; |
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { { if (newkeys == 65536) { if(IsPlayerInRangeOfPoint(playerid,50,1279.2273,-1249.4648,13.5191)) { new Text:intro; TextDrawShowForPlayer(playerid,intro); } } // This is if player Pressed LMB Then Textdraw will get hide if (newkeys == KEY_FIRE) { new Text:intro; TextDrawHideForPlayer(playerid,intro); } return 1; |
new Text:gMyText = Text:INVALID_TEXT_DRAW; //This initializes the variable to an invalid TextDraw before creating the TextDraw.
new PlayerText:gMyPlayerText[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...}; //This initializes every element of the array to an invalid TextDraw before creating every TextDraw.
Global TextDraws:
Код:
new Text:gMyText = Text:INVALID_TEXT_DRAW; //This initializes the variable to an invalid TextDraw before creating the TextDraw. For example:
Код:
new PlayerText:gMyPlayerText[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...}; //This initializes every element of the array to an invalid TextDraw before creating every TextDraw. For example:
|
thanks but where do i put this new PlayerText:gMyPlayerText[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
|
And do i need to change anything from here >new PlayerText:gMyPlayerText[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
|
Wait I'll answer everything individually.
Top of your script is a good position. No, it makes sure there won't be any conflicts with other TextDraws. You can change the name gMyPlayerText to anything you want of course. When you are not pressing any other keys and really no other keys yes, that will work. As soon as you for example try crouching and pressing that key, it will not work anymore. I still suggest reading that wiki page. Try compiling what you have already. |
public OnFilterScriptInit() { new Text:intro; intro = TextDrawCreate(24.399976, 195.646636, "random"); new PlayerText:gMyPlayerText[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...}; TextDrawLetterSize(intro, 0.400000, 1.600000); TextDrawTextSize(intro, 639.000000, 0.000000); TextDrawAlignment(intro, 1); TextDrawColor(intro, -1); TextDrawUseBox(intro, 1); TextDrawBoxColor(intro, 255); TextDrawSetShadow(intro, 0); TextDrawSetOutline(intro, 0); TextDrawBackgroundColor(intro, 255); TextDrawFont(intro, 1); TextDrawSetProportional(intro, 1); TextDrawSetShadow(intro, 0); return 1; } |
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { { if (newkeys == 65536) { if(IsPlayerInRangeOfPoint(playerid,50,1279.2273,-1249.4648,13.5191)) { new Text:intro; TextDrawShowForPlayer(playerid,intro); } } // This is if player Pressed LMB Then Textdraw will get hide if (newkeys == KEY_FIRE) { new Text:intro; TextDrawHideForPlayer(playerid,intro); } return 1; } } |
//OnFilterScriptInit new Text:intro; //This means you can only use this TextDraw inside OnFilterScriptInit //You also didn't initialize it new PlayerText:gMyPlayerText[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...}; //You just copy-pasted this line... You're not even using this TextDraw anywhere //OnPlayerKeyStateChange new Text:intro; //You're redefining this new Text:intro; //You're redefining this, for the second time
//OnFilterScriptInit intro = TextDrawCreate(24.399976, 195.646636, "random"); TextDrawLetterSize(intro, 0.400000, 1.600000); TextDrawTextSize(intro, 639.000000, 0.000000); TextDrawAlignment(intro, 1); TextDrawColor(intro, -1); TextDrawUseBox(intro, 1); TextDrawBoxColor(intro, 255); TextDrawSetShadow(intro, 0); TextDrawSetOutline(intro, 0); TextDrawBackgroundColor(intro, 255); TextDrawFont(intro, 1); TextDrawSetProportional(intro, 1); TextDrawSetShadow(intro, 0); //OnPlayerKeyStateChange TextDrawShowForPlayer(playerid,intro); TextDrawHideForPlayer(playerid,intro);
//Top of script new Text:intro = Text:INVALID_TEXT_DRAW;