Show different textdraw if player is registered
#3

learn here
1. https://sampwiki.blast.hk/wiki/TextDrawCreate
2. https://sampwiki.blast.hk/wiki/OnPlayerClickTextDraw

pawn Код:
new Text:WelcomeRegisterText;
new Text:WelcomeLoginText;

public OnGameModeInit()
{
    // This line is used to create the textdraw.
    // Note: This creates a textdraw without any formatting.
    WelcomeRegisterText = TextDrawCreate(240.0,580.0,"Register");
    TextDrawSetSelectable(WelcomeRegisterText, 1);
   
   
    WelcomeLoginText = TextDrawCreate(240.0,580.0,"Login");
    TextDrawSetSelectable(WelcomeLoginText, 1);
    return 1;
}

public OnPlayerConnect(playerid)
{
    //This is used to show the player the textdraw when they connect.
    // ADD HERE if( player first time log in) then....
    TextDrawShowForPlayer(playerid,WelcomeRegisterText);
   
   
    //ADD HERE if( player registered) already
    TextDrawShowForPlayer(playerid,WelcomeLoginText);
   
   
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SUBMISSION)
    {
        TextDrawShowForPlayer(playerid, WelcomeRegisterText);
        TextDrawShowForPlayer(playerid, WelcomeLoginText);
        SelectTextDraw(playerid, 0xFF4040AA);
       
    }
    return 1;
}

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == WelcomeRegisterText)
    {
         SendClientMessage(playerid, 0xFFFFFFAA, "You clicked on register textdraw.");
         CancelSelectTextDraw(playerid);
         return 1;
    }
    else if(clickedid == WelcomeLoginText)
    {
         SendClientMessage(playerid, 0xFFFFFFAA, "You clicked on Login textdraw.");
         CancelSelectTextDraw(playerid);
         return 1;
    }
    return 0;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)