[Pedido] TextDraw com botхes
#1

Код:
//|_________________Sistema de puxar players para evento_________________|

CMD:convidartodos(playerid, params[])
{
    new
        Float:x,
        Float:y,
        Float:z;

    GetPlayerPos(playerid, x, y, z);

    for (new i = 0; i < MAX_PLAYERS; i ++) if (!GetPVarFloat(i, "AdmX")) {

        SetPVarFloat(i, "AdmX", x);
        SetPVarFloat(i, "AdmY", y);
        SetPVarFloat(i, "AdmZ", z);
    }
    SendClientMessageToAll(COLOR_LIGHTBLUE, "|_____________________________EVENTO____________________________|.");
    SendClientMessageToAll(COLOR_LIGHTBLUE, "Um Administrador estб convidado todos do servidor para ir atй ele.");
    SendClientMessageToAll(COLOR_LIGHTBLUE, "Use /aceitaradm para ir ao evento ou /negaradm para nгo ir.");
    SendClientMessageToAll(COLOR_LIGHTBLUE, "|_____________________________EVENTO____________________________|.");
    return 1;
}

CMD:aceitaradm(playerid, params[])
{
    if (!GetPVarFloat(playerid, "AdmX"))
        return 1;

    SetPlayerPos(playerid, GetPVarFloat(playerid, "AdmX"), GetPVarFloat(playerid, "AdmY"), GetPVarFloat(playerid, "AdmZ"));

    DeletePVar(playerid, "AdmX");
    DeletePVar(playerid, "AdmY");
    DeletePVar(playerid, "AdmZ");
    SendClientMessage(playerid, -1, "Vocк aceitou o convite da administraзгo.");
    SendClientMessage(playerid, -1, "Vocк aceitou o convite da administraзгo.");
    return 1;
}

CMD:negaradm(playerid, params[])
{
    if (!GetPVarFloat(playerid, "AdmX"))
        return 1;

    DeletePVar(playerid, "AdmX");
    DeletePVar(playerid, "AdmY");
    DeletePVar(playerid, "AdmZ");
    SendClientMessage(playerid, -1, "Vocк nгo aceitou o convite da administraзгo.");
    SendClientMessage(playerid, -1, "Vocк nгo aceitou o convite da administraзгo.");
    return 1;
}

CMD:cancelarconvite(playerid, params[])
{
    for (new i = 0; i < MAX_PLAYERS; i ++) if (!GetPVarFloat(i, "AdmX")) {
        DeletePVar(i, "AdmX");
        DeletePVar(i, "AdmY");
        DeletePVar(i, "AdmZ");
    }
    SendClientMessageToAll(COLOR_LIGHTBLUE, "|________________ANЪNCIO ADMIN____________|");
    SendClientMessageToAll(COLOR_LIGHTBLUE, "O convite para ir ao evento foi cancelado");
    SendClientMessageToAll(COLOR_LIGHTBLUE, "|________________ANЪNCIO ADMIN____________|");
    return 1;
}
Eu queria passar tudo isso para TextDraw '-'

O /convidartodos faria um textdraw para todos com dois botхes

"Aceitar" "Negar"

E assim iria ser desnecessбrio o /cancelarconvite
Reply
#2

Funзгo: OnPlayerClickTextDraw

Exemplo: by Wiki

PHP код:
new Text:gTextDraw;
 
public 
OnGameModeInit()
{
    
gTextDraw TextDrawCreate(10.000000141.000000"MyTextDraw");       
    
TextDrawTextSize(gTextDraw,60.00000020.000000);
    
TextDrawAlignment(gTextDraw,0);
    
TextDrawBackgroundColor(gTextDraw,0x000000ff);
    
TextDrawFont(gTextDraw,1);
    
TextDrawLetterSize(gTextDraw,0.2500001.000000);
    
TextDrawColor(gTextDraw,0xffffffff);
    
TextDrawSetProportional(gTextDraw,1);
    
TextDrawSetShadow(gTextDraw,1);
    
TextDrawSetSelectable(gTextDraw1);
    return 
1;
}
 
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
newkeys == KEY_SUBMISSION)
    {
        
TextDrawShowForPlayer(playeridgTextDraw);
        
SelectTextDraw(playerid0xFF4040AA);
    }
    return 
1;
}
 
public 
OnPlayerClickTextDraw(playeridText:clickedid)
{
    if(
clickedid == gTextDraw)
    {
         
SendClientMessage(playerid0xFFFFFFAA"You clicked on a textdraw.");
         
CancelSelectTextDraw(playerid);
    }
    return 
1;

https://sampwiki.blast.hk/wiki/OnPlayerClickTextDraw
Reply
#3

Ok, Muito obrigado =)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)