[Ajuda] Textdraw
#1

galera eu montei um textdraw com stats mais tipo eu quero, por so o textdraw que mostra os nicks do player, nao to conseguindo por na gamemode alguem pode me ajuda?

Quote:
Код HTML:
/*

Reklez's Player Info Textdraw [FS]
Author: Reklez
©, 2012

*/

#include <a_samp>
#include <zcmd>
#define PLAYERS 200

new PlayerText:Name[MAX_PLAYERS];
new bool:loggedFirstTime[MAX_PLAYERS];
new Float:health,
        Float:armour,
    Text:PHealth[MAX_PLAYERS],
    Text:PArmour[MAX_PLAYERS],
    Text:PPing[MAX_PLAYERS],
    Text:PCash[MAX_PLAYERS],
    Text:PScore[MAX_PLAYERS];

#if defined FILTERSCRIPT

#else

public OnFilterScriptInit()
{
        print("\nReklez's Playerinfo Textdraw [FS], © 2012\n");
        return 1;
}

public OnFilterScriptExit()
{
        print("\nReklez's Playerinfo Textdraw [FS] Unloaded, © 2012\n");
        return 1;
}

#endif

public OnPlayerConnect(playerid)
{
        PHealth[playerid] = TextDrawCreate(182.000000,436.000000,"Vida:");
        PArmour[playerid] = TextDrawCreate(243.000000,436.000000,"Colete:");
        PPing[playerid] = TextDrawCreate(319.000000,436.000000,"Ping:");
        PScore[playerid] = TextDrawCreate(499.000000,1.000000,"Mata Mata Brasileiro");
        PCash[playerid] = TextDrawCreate(1.000000,436.000000," Text");
        TextDrawAlignment(PHealth[playerid],0);
        TextDrawAlignment(PArmour[playerid],0);
        TextDrawAlignment(PPing[playerid],0);
        TextDrawAlignment(PScore[playerid],0);
        TextDrawAlignment(PCash[playerid],0);
        TextDrawBackgroundColor(PCash[playerid],0x000000ff);
        TextDrawFont(PCash[playerid],2);
        TextDrawLetterSize(PCash[playerid],0.199999,1.100000);
        TextDrawColor(PCash[playerid],0xffffffff);
        TextDrawSetOutline(PCash[playerid],1);
        TextDrawFont(PHealth[playerid],2);
        TextDrawLetterSize(PHealth[playerid],0.199999,1.100000);
        TextDrawFont(PArmour[playerid],2);
        TextDrawLetterSize(PArmour[playerid],0.199999,1.100000);
        TextDrawFont(PPing[playerid],2);
        TextDrawLetterSize(PPing[playerid],0.199999,1.100000);
        TextDrawFont(PScore[playerid],3);
        TextDrawLetterSize(PScore[playerid],0.299999,2.299999);
        TextDrawColor(PHealth[playerid],0xffffffff);
        TextDrawColor(PArmour[playerid],0xffffffff);
        TextDrawColor(PPing[playerid],0xffffffff);
        TextDrawColor(PScore[playerid],-16776961);
        TextDrawSetOutline(PHealth[playerid],1);
        TextDrawSetOutline(PArmour[playerid],1);
        TextDrawSetOutline(PPing[playerid],1);
        TextDrawSetOutline(PScore[playerid],1);
        TextDrawSetShadow(PHealth[playerid],1);
        TextDrawSetShadow(PArmour[playerid],1);
        TextDrawSetShadow(PPing[playerid],1);
        TextDrawSetShadow(PScore[playerid],1);
        TextDrawUseBox(PHealth[playerid],1);
        TextDrawBoxColor(PHealth[playerid],0x000000cc);
        TextDrawTextSize(PHealth[playerid],240.000000,0.000000);
        TextDrawBackgroundColor(PHealth[playerid],0x000000ff);
        TextDrawSetShadow(PHealth[playerid],1);
        TextDrawSetProportional(PHealth[playerid],1);
        TextDrawUseBox(PArmour[playerid],1);
        TextDrawBoxColor(PArmour[playerid],0x000000cc);
        TextDrawTextSize(PArmour[playerid],315.000000,0.000000);
        TextDrawBackgroundColor(PArmour[playerid],0x000000ff);
        TextDrawSetShadow(PArmour[playerid],1);
        TextDrawSetProportional(PArmour[playerid],1);
        TextDrawUseBox(PPing[playerid],1);
        TextDrawBoxColor(PPing[playerid],0x000000cc);
        TextDrawTextSize(PPing[playerid],371.000000,0.000000);
        TextDrawBackgroundColor(PPing[playerid],0x000000ff);
        TextDrawSetProportional(PPing[playerid],1);
        TextDrawSetShadow(PPing[playerid],1);
        TextDrawBackgroundColor(PScore[playerid],0xFFFFFFFF);
        TextDrawSetProportional(PScore[playerid],1);
        TextDrawUseBox(PCash[playerid],1);
        TextDrawBoxColor(PCash[playerid],0x000000cc);
        TextDrawTextSize(PCash[playerid],178.000000,0.000000);
        TextDrawSetOutline(PCash[playerid],1);
        TextDrawSetProportional(PCash[playerid],1);
        TextDrawSetShadow(PCash[playerid],1);

		loggedFirstTime[playerid] = true;

        Name[playerid] = CreatePlayerTextDraw(playerid, 497.000000,436.000000," ");
        PlayerTextDrawBackgroundColor(playerid, Name[playerid], 0x000000ff);
        PlayerTextDrawFont(playerid, Name[playerid], 2);
        PlayerTextDrawLetterSize(playerid, Name[playerid],0.199999,1.100000);
        PlayerTextDrawColor(playerid, Name[playerid], 0xffffffff);
        PlayerTextDrawSetOutline(playerid, Name[playerid], 1);
        PlayerTextDrawSetProportional(playerid, Name[playerid], 1);
        PlayerTextDrawSetShadow(playerid, Name[playerid],1);
        PlayerTextDrawUseBox(playerid, Name[playerid],1);
        PlayerTextDrawBoxColor(playerid, Name[playerid],0x000000cc);
        PlayerTextDrawTextSize(playerid, Name[playerid],638.000000,0.000000);
        PlayerTextDrawAlignment(playerid, Name[playerid],0);

        new playerName[MAX_PLAYER_NAME], str[MAX_PLAYER_NAME + 10];
        GetPlayerName(playerid, playerName, sizeof(playerName));
        format(str, sizeof(str), "~w~Nick: ~r~%s", playerName);
        PlayerTextDrawSetString(playerid, Name[playerid], str);


	    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
        TextDrawHideForPlayer(playerid, PHealth[playerid]);
        TextDrawHideForPlayer(playerid, PArmour[playerid]);
        TextDrawHideForPlayer(playerid, PPing[playerid]);
        TextDrawHideForPlayer(playerid, PScore[playerid]);
        TextDrawHideForPlayer(playerid, PCash[playerid]);
		return 1;
}

public OnPlayerSpawn(playerid)
{
        TextDrawShowForPlayer(playerid, PHealth[playerid]);
        TextDrawShowForPlayer(playerid, PArmour[playerid]);
        TextDrawShowForPlayer(playerid, PPing[playerid]);
        TextDrawShowForPlayer(playerid, PScore[playerid]);
        TextDrawShowForPlayer(playerid, PCash[playerid]);

		if(loggedFirstTime[playerid]) {
        loggedFirstTime[playerid] = false;
        PlayerTextDrawShow(playerid, Name[playerid]);
    }
		return 1;
}

COMMAND:pnhaoff(playerid,params[])
{
    PlayerTextDrawHide(playerid, Name[playerid]);
    return 1;
}

public OnPlayerUpdate(playerid)
{
        new InfoString[300];
        if(IsPlayerConnected(playerid))
        {
                if(IsPlayerNPC(playerid)) return 0;
                GetPlayerHealth(playerid, health);
                GetPlayerArmour(playerid, armour);
                new ping = GetPlayerPing(playerid);
                new score = GetPlayerScore(playerid);
                new cash = GetPlayerMoney(playerid);
                format(InfoString, sizeof(InfoString), "VIDA: ~r~%.1f", health);
                TextDrawSetString(PHealth[playerid], InfoString);
                format(InfoString, sizeof(InfoString), "Colete: ~r~%.1f", armour);
                TextDrawSetString(PArmour[playerid], InfoString);
                format(InfoString, sizeof(InfoString), "Ping: ~r~%d", ping);
                TextDrawSetString(PPing[playerid], InfoString);
                format(InfoString, sizeof(InfoString), "~l~Mata Mata Brasileiro", score);
                TextDrawSetString(PScore[playerid], InfoString);
                format(InfoString, sizeof(InfoString), "       ~r~] ~w~Mata Mata Brasileiro ~r~]", cash);
                TextDrawSetString(PCash[playerid], InfoString);
        }
        return 1;
}
Reply
#2

#edit
Reply
#3

crie a playertext no onplayerconnect da maneira q vocк quer, e dк showplayertextdraw na parte que vocк quer, nгo tem mistйrio, й sу seguir a lуgica.
Reply
#4

PHP код:
//======------TOPO---------//
new PlayerText:MyName;
//======--------===========//
public OnPlayerConnect(playerid)//
{
    
MyName[playerid] = CreatePlayerTextDraw(playerid497.000000,436.000000,"Hello Wolrd");
    
PlayerTextDrawBackgroundColor(playeridMyName[playerid], 0x000000ff);
    
PlayerTextDrawFont(playeridMyName[playerid], 2);
    
PlayerTextDrawLetterSize(playeridMyName[playerid],0.199999,1.100000);
    
PlayerTextDrawColor(playeridMyName[playerid], 0xffffffff);
    
PlayerTextDrawSetOutline(playeridMyName[playerid], 1);
    
PlayerTextDrawSetProportional(playeridMyName[playerid], 1);
    
PlayerTextDrawSetShadow(playeridMyName[playerid],1);
    
PlayerTextDrawUseBox(playeridMyName[playerid],1);
    
PlayerTextDrawBoxColor(playeridMyName[playerid],0x000000cc);
    
PlayerTextDrawTextSize(playeridMyName[playerid],638.000000,0.000000);
    
PlayerTextDrawAlignment(playeridMyName[playerid],0);
    new 
newtext[41], name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnameMAX_PLAYER_NAME);
    
format(newtextsizeof(newtext), "~g~Nick: ~w~%s"name);
    
PlayerTextDrawSetString(MyNamenewtext);
    
PlayerTextDrawShowForPlayer(playeridMyName);
    return 
1;

Reply
#5

Quote:
Originally Posted by iTakelot
Посмотреть сообщение
PHP код:
//======------TOPO---------//
new PlayerText:MyName;
//======--------===========//
public OnPlayerConnect(playerid)//
{
    
MyName[playerid] = CreatePlayerTextDraw(playerid497.000000,436.000000,"Hello Wolrd");
    
PlayerTextDrawBackgroundColor(playeridMyName[playerid], 0x000000ff);
    
PlayerTextDrawFont(playeridMyName[playerid], 2);
    
PlayerTextDrawLetterSize(playeridMyName[playerid],0.199999,1.100000);
    
PlayerTextDrawColor(playeridMyName[playerid], 0xffffffff);
    
PlayerTextDrawSetOutline(playeridMyName[playerid], 1);
    
PlayerTextDrawSetProportional(playeridMyName[playerid], 1);
    
PlayerTextDrawSetShadow(playeridMyName[playerid],1);
    
PlayerTextDrawUseBox(playeridMyName[playerid],1);
    
PlayerTextDrawBoxColor(playeridMyName[playerid],0x000000cc);
    
PlayerTextDrawTextSize(playeridMyName[playerid],638.000000,0.000000);
    
PlayerTextDrawAlignment(playeridMyName[playerid],0);
    new 
newtext[41], name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnameMAX_PLAYER_NAME);
    
format(newtextsizeof(newtext), "~g~Nick: ~w~%s"name);
    
PlayerTextDrawSetString(MyNamenewtext);
    
PlayerTextDrawShowForPlayer(playeridMyName);
    return 
1;

Coloquei do geito que voce me mando mais deu esses ERROS:

C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6629) : error 028: invalid subscript (not an array or too many subscripts): "MyName"
C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6629) : warning 215: expression has no effect
C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6629) : error 001: expected token: ";", but found "]"
C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6629) : error 029: invalid expression, assumed zero
C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6629) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

Quote:
Originally Posted by maxblaya01
Посмотреть сообщение
Coloquei do geito que voce me mando mais deu esses ERROS:

C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6629) : error 028: invalid subscript (not an array or too many subscripts): "MyName"
C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6629) : warning 215: expression has no effect
C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6629) : error 001: expected token: ";", but found "]"
C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6629) : error 029: invalid expression, assumed zero
C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6629) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
o "iTakelot" passou um code errado, coloca assim!

PHP код:
new PlayerText:MyName[MAX_PLAYERS]; 
Reply
#7

Quote:
Originally Posted by IgorLuiz
Посмотреть сообщение
o "iTakelot" passou um code errado, coloca assim!

PHP код:
new PlayerText:MyName[MAX_PLAYERS]; 
deu esses 2 ERROS: sabe como concerto?

C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6644) : error 035: argument type mismatch (argument 1)
C:\Users\Max\Desktop\0.3.7 R2\gamemodes\MataMataBR.pwn(6645) : error 017: undefined symbol "PlayerTextDrawShowForPlayer"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)