Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //------------------------------------------------------------------------------------------//
- // como Fazer Text-Draws //
- //------------------------------------------------------------------------------------------//
- /*
- Se você quiser cirar um texto em qualquer lugar (Vamos Fazer um Relogio)
- */
- forward Clock();//crie para a callback do settimer e para atualizar o relogio.
- new Text:TextHora[MAX_PLAYERS];//Para poder dar efeito na hora de fazer funcionar
- //-------------------------------------------//
- //Agora, para quando o player logar ver a Text Draw vamos adicionar isso na callback:
- //public OnPlayerConnect
- public OnPlayerConnect(playerid)
- {
- TextDrawShowForPlayer(playerid, TextHora[playerid]);
- return 1;
- }
- //Agora Adicione isso na callback OnGamemodeInit, Isso server para quando o seu Gamemode //Iniciar
- public OnGamemodeInit()
- {
- SetTimer("Clock", 1000, 1);//para o Relogio não se descontrolar
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- TextHora[i] = TextDrawCreate(551.000000,23.000000,"--");
- TextDrawAlignment(TextHora[i],0);
- TextDrawBackgroundColor(TextHora[i],0x000000FF);
- TextDrawFont(TextHora[i],2);
- TextDrawLetterSize(TextHora[i],0.399999,2.000000);
- TextDrawColor(TextHora[i],0x000000FF);
- TextDrawSetOutline(TextHora[i],1);
- TextDrawSetProportional(TextHora[i],1);
- TextDrawSetShadow(TextHora[i],1);
- }
- return 1;
- }
- public Clock()//crie essa callback para o settimer funcionar e atualizar a hora
- {
- new str[128], str2[128];
- new hora, minuto, segundo;
- gettime(hora, minuto, segundo);
- for (new i=0; i<MAX_PLAYERS; i++)
- {
- format(str2, sizeof(str2), "%d:%d:%d", hora, minuto, segundo);
- TextDrawSetString(TextHora[i], str2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement