TextDraw
#1

Hey all, I am wondering if its possible to have a textdraw that shows players score witch will refresh every one minute

I have a variable for score and saving data system..for example here

Код:
if(strcmp(cmdtext, "/info", true) == 0)
{
new strin[400];
GetPlayerIp(playerid, ip2, sizeof(ip2));
GetPlayerPing(playerid);

format(strin,sizeof(strin),"{990099}===============Informacie===============\n\n",strin);
format(strin,sizeof(strin),"%s{FFFFFF}Nick: {990099}%s\n{FFFFFF}ID: {990099}%i\n{FFFFFF}IP Adresa: {990099}%s\n{FFFFFF}Ping: {990099}%d\n{FFFFFF}Verzia SAMP: {990099}0.3x-R1-2\n{FFFFFF}Score: {990099}%d\n{FFFFFF}Peniaze: {990099}$%d\n{FFFFFF}Zomrel: {990099}%d\n{FFFFFF}Zabil: {990099}%d\n",strin,Jmeno(playerid),playerid,GetPlayerIpEx(playerid),GetPlayerPing(playerid),pScore[playerid],GetPlayerMoney(playerid),pDeaths[playerid],pKills[playerid]);
ShowPlayerDialog(playerid,5,DIALOG_STYLE_MSGBOX,"INFO",strin,"Zavriet","");
return 1; 
}
Код:
new pScore[MAX_PLAYERS_EX];
I want to make a textdraw witch will show the score in top right cone of the screen

here is my try

Код:
 /////////////////////////////////////score
    score = TextDrawCreate(545.0, 35.0, "Score: %d"pScore[playerid]);
    TextDrawLetterSize(score , 0.2, 1.0);
    TextDrawColor(score , 0x800080FF);
    TextDrawSetShadow(score , 2);
    TextDrawSetOutline(score , true);
Код:
new Text:score = Text:INVALID_TEXT_DRAW;
Reply
#2

Place an update timer and use

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

Thats the problem, ive never used timers or textdrawsetstring so im dump at this
Reply
#4

something like that

pawn Код:
new Text:score[MAX_PLAYERS];//define var for textdraw (MAX_PLAYERS)

public OnGameModeInit()
{
    SetTimer("MyFunction",2000,true);//creates the timer
    /*Creates the textdraw for every player*/
    for(new i = 0; i != MAX_PLAYERS; i++) {//loop trough all players (i = playerid)
        score[i] = TextDrawCreate(545.0, 35.0, "_");
        TextDrawLetterSize(score[i] , 0.2, 1.0);
        TextDrawColor(score[i] , 0x800080FF);
        TextDrawSetShadow(score[i] , 2);
        TextDrawSetOutline(score[i] , true);
    }
    return 1;
}

forward MyFunction();//forward the function
public MyFunction()//the function (MyFunction)
{
    new text[41];//variable store the text
    for(new i = 0; i != MAX_PLAYERS; i++) {//loop trough all players (i = playerid)
        if(IsPlayerConnected(i)) { //player is connected ok then do something
            format(text, sizeof(text), "Score: %d",pScore[i]);
            TextDrawSetString(score[i], text);
            TextDrawShowForPlayer(i,score[i]);
        }
    }
}
Reply
#5

im confused too many errors
Reply
#6

Becouse is just a code to show you how it works.. you have to fit it in your gm
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)