SA-MP Forums Archive
Textdraw - 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)
+--- Thread: Textdraw (/showthread.php?tid=624481)



Textdraw - Loinal - 17.12.2016

When the mouse pointer be on edm it make red highlight on stunt and edm but when i order the mouse pointer to be on stunt it select stunt only so i need it to select edm only or stunt only codes

PHP код:
public OnGameModeInit()
{
TDEditor_TD[0] = TextDrawCreate(1.200059, -1.146733, "_____~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~");
TextDrawLetterSize(TDEditor_TD[0], 0.400000, 1.600000);
TextDrawTextSize(TDEditor_TD[0], 636.000000, 0.000000);
TextDrawAlignment(TDEditor_TD[0], 1);
TextDrawColor(TDEditor_TD[0], -65347);
TextDrawUseBox(TDEditor_TD[0], 1);
TextDrawBoxColor(TDEditor_TD[0], 8593);
TextDrawSetShadow(TDEditor_TD[0], 0);
TextDrawSetOutline(TDEditor_TD[0], 0);
TextDrawBackgroundColor(TDEditor_TD[0], 5674141);
TextDrawFont(TDEditor_TD[0], 1);
TextDrawSetProportional(TDEditor_TD[0], 1);
TextDrawSetShadow(TDEditor_TD[0], 0);
TDEditor_TD[1] = TextDrawCreate(139.893157, 190.500122, "~n~______Stunt~n~~n~");
TextDrawLetterSize(TDEditor_TD[1], 0.402399, 1.435732);
TextDrawAlignment(TDEditor_TD[1], 1);
TextDrawColor(TDEditor_TD[1], -1);
TextDrawSetShadow(TDEditor_TD[1], 0);
TextDrawSetOutline(TDEditor_TD[1], 0);
TextDrawBackgroundColor(TDEditor_TD[1], 255);
TextDrawFont(TDEditor_TD[1], 2);
TextDrawSetProportional(TDEditor_TD[1], 1);
TextDrawSetShadow(TDEditor_TD[1], 0);
TextDrawSetSelectable(TDEditor_TD[1], true);
TDEditor_TD[2] = TextDrawCreate(290.000000, 190.746673, "____________________~n~______EDM~n~~n~");
TextDrawLetterSize(TDEditor_TD[2], 0.388799, 1.443199);
TextDrawAlignment(TDEditor_TD[2], 1);
TextDrawColor(TDEditor_TD[2], -50331649);
TextDrawSetShadow(TDEditor_TD[2], 0);
TextDrawSetOutline(TDEditor_TD[2], 0);
TextDrawBackgroundColor(TDEditor_TD[2], 255);
TextDrawFont(TDEditor_TD[2], 2);
TextDrawSetProportional(TDEditor_TD[2], 1);
TextDrawSetShadow(TDEditor_TD[2], 0);
TextDrawSetSelectable(TDEditor_TD[2], true);
TDEditor_TD[3] = TextDrawCreate(457.200042, 1.093325, "NourX_Project_1.0.0");
TextDrawLetterSize(TDEditor_TD[3], 0.400000, 1.600000);
TextDrawAlignment(TDEditor_TD[3], 1);
TextDrawColor(TDEditor_TD[3], -1);
TextDrawSetShadow(TDEditor_TD[3], 0);
TextDrawSetOutline(TDEditor_TD[3], 0);
TextDrawBackgroundColor(TDEditor_TD[3], 255);
TextDrawFont(TDEditor_TD[3], 2);
TextDrawSetProportional(TDEditor_TD[3], 1);
TextDrawSetShadow(TDEditor_TD[3], 0);
    
TextDrawSetSelectable(TDEditor_TD[0], false);
TextDrawSetSelectable(TDEditor_TD[3], false);
    
SetGameModeText("NourX v1");
    
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 
1;
} 
PHP код:
public OnPlayerConnect(playerid)
{
    
SendClientMessage(playerid, COLOR_MTA, "Welcome to NourX RDM Server");
    new 
string[156], name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid, name, sizeof name);
    
format(string, sizeof string, "%s has joined this server.", name);
    
SendClientMessageToAll(COLOR_MTA, string);
    
TextDrawShowForPlayer(playerid,TDEditor_TD[0]);
    
TextDrawShowForPlayer(playerid,TDEditor_TD[1]);
    
TextDrawShowForPlayer(playerid,TDEditor_TD[2]);
    
TextDrawShowForPlayer(playerid,TDEditor_TD[3]);
    
SelectTextDraw(playerid, 0xFF0000FF);
    return 
1;
} 
PHP код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(
_:clickedid != INVALID_TEXT_DRAW) // If the player clicked a valid textdraw, continue with the coding. (_:var removes the Text: tag, to avoid tag mismatch)
    
{
        if(
clickedid == TDEditor_TD[2])
        {
    
LoadText();
    
UMapTimer = SetTimer("ServerData_UpdateMAP", 800, true);
    
SetTimer("ServerData_AlivePlayers", 800, true);
    if(
ServerData[Started] == true) {
    
SetPVarInt(playerid, "Geberdi", 1);
    if(
GetServerCount() > 1){
    
StartSpectate(playerid, GetRandomPlayer(playerid));}
    }
    
SetPVarInt(playerid, "Spawned", 1);
    
TextDrawShowForPlayer(playerid, MapText);
    
TextDrawShowForPlayer(playerid, GecenSurem[playerid]);
    
TextDrawShowForPlayer(playerid, SpectateYou[playerid]);
    
DisableRemoteVehicleCollisions(playerid, true);
    
TogglePlayerSpectating(playerid, false);
    
SpawnPlayer(playerid);
        }
        else if(
clickedid == TDEditor_TD[1])
        {
        
ShowPlayerDialog(playerid,2000,DIALOG_STYLE_MSGBOX,"Stunt/Freeroam","NourX Community.\nSorry, The Stunt/Freeroam mode is coming soon, Please rejoin the server and choose onther Mode.","Ok","");
        }
        
TextDrawHideForPlayer(playerid, TDEditor_TD[0]);
        
TextDrawHideForPlayer(playerid, TDEditor_TD[1]);
        
TextDrawHideForPlayer(playerid, TDEditor_TD[2]);
        
TextDrawHideForPlayer(playerid, TDEditor_TD[3]);
        
CancelSelectTextDraw(playerid); // This will indeed call OnPlayerClickTextDraw again, but with an ID of 65535. The code above stops it from resulting in an eternal loop.
    
}
    return 
1;
} 



Re: Textdraw - Loinal - 17.12.2016

Help?


Re: Textdraw - Loinal - 18.12.2016

Help me!


Re: Textdraw - Amads - 18.12.2016

I think you need to set TextDrawTextSize for your clickable textdraws.
"This function defines the clickable area for use with TextDrawSetSelectable, whether a box is shown or not." - https://sampwiki.blast.hk/wiki/TextDrawTextSize


Re: Textdraw - Loinal - 18.12.2016

Can you fix my codes?


Re: Textdraw - Sew_Sumi - 23.12.2016

Код:
TextDrawTextSize(TDEditor_TD[1],X,Y);
TextDrawTextSize(TDEditor_TD[2],X,Y);
Where X and Y are coordinates relating to the center of the clickable stuff, such as the "EDM", or the "Stunt" portions. You'll need to plot them out, and refine them.

But really, what's it not doing?