SA-MP Forums Archive
What is that ? Textdraws - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What is that ? Textdraws (/showthread.php?tid=519110)



What is that ? Textdraws - Le3aT - 12.06.2014

I made a variable.

PHP код:
new kills[MAX_PLAYERS]
public 
OnPlayerDeath(playeridkilleridreason)
{
    
kills[killerid]++;
    return 
1;

Here is the question, I made a textdraw and made it the kills itself
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
kills[killerid]++;
    
kills[playerid] = 0;
    
TextDrawSetString(Textdraw6kills);
    return 
1;

When someone kills me or gets killed, It doesn't reset or change. What is the problem ?


Re: What is that ? Textdraws - Abagail - 12.06.2014

Is this supposed to be a server-wide textdraw, or a textdraw for one player?


Re: What is that ? Textdraws - Le3aT - 12.06.2014

For the killerid and playerid, not server-wide


Re: What is that ? Textdraws - AiRaLoKa - 12.06.2014

you need to show the textdraw again after you edit the string


Re: What is that ? Textdraws - Le3aT - 12.06.2014

i did, But it doesn't give numbers, It gives something weird like shapes. maybe because it's a string not integer ?


Re: What is that ? Textdraws - Le3aT - 12.06.2014

I don't know, It just keeps giving strings not numbers.


Re: What is that ? Textdraws - SilentSoul - 12.06.2014

You should do it like this, Also make sure you showed the textdraws to the player first.
pawn Код:
new string[24];
format(string,sizeof(string),"%d",kills[killerid]);
TextDrawSetString(Textdraw6, string);



Re: What is that ? Textdraws - AiRaLoKa - 13.06.2014

first, you have to define it...
pawn Код:
new Text:Textdraw6[MAX_PLAYERS]; // So it will make it different for every player
then change evething
from
pawn Код:
Textdraw6
into
pawn Код:
Textdraw6[playerid] //except on the on player death
at the OnPlayerDeath

change
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    kills[killerid]++;
    kills[playerid] = 0;
    TextDrawSetString(Textdraw6, kills);
    return 1;
}
into
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new str[32];
    kills[killerid]++;
    kills[playerid] = 0;
    format(str,sizeof(str,"%d",kills[killerid]);//to convert from integer into string
    TextDrawSetString(Textdraw6[killerid], str);//to set the killer's textdraw
    TextDrawShowForPlayer(killerid,Textdraw6[killerid]);//show the textdraw to killer

    format(str,sizeof(str,"%d",kills[playerid]);//to convert from integer into string
    TextDrawSetString(Textdraw6[playerid], str);//to set the player's textdraw
    TextDrawShowForPlayer(playerid,Textdraw6[playerid]);//show the textdraw to player
    return 1;
}



Re: What is that ? Textdraws - Le3aT - 13.06.2014

Quote:
Originally Posted by AiRaLoKa
Посмотреть сообщение
first, you have to define it...
pawn Код:
new Text:Textdraw6[MAX_PLAYERS]; // So it will make it different for every player
then change evething
from
pawn Код:
Textdraw6
into
pawn Код:
Textdraw6[playerid] //except on the on player death
at the OnPlayerDeath

change
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    kills[killerid]++;
    kills[playerid] = 0;
    TextDrawSetString(Textdraw6, kills);
    return 1;
}
into
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new str[32];
    kills[killerid]++;
    kills[playerid] = 0;
    format(str,sizeof(str,"%d",kills[killerid]);//to convert from integer into string
    TextDrawSetString(Textdraw6[killerid], str);//to set the killer's textdraw
    TextDrawShowForPlayer(killerid,Textdraw6[killerid]);//show the textdraw to killer

    format(str,sizeof(str,"%d",kills[playerid]);//to convert from integer into string
    TextDrawSetString(Textdraw6[playerid], str);//to set the player's textdraw
    TextDrawShowForPlayer(playerid,Textdraw6[playerid]);//show the textdraw to player
    return 1;
}
pawn Код:
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(853) : error 033: array must be indexed (variable "Textdraw6")
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(854) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(855) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(856) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(857) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(858) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(859) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(860) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(869) : error 035: argument type mismatch (argument 2)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(887) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(888) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


11 Errors.
The code

pawn Код:
Textdraw6 = TextDrawCreate(117.000000, 330.000000, "0");
    TextDrawAlignment(Textdraw6, 2);
    TextDrawBackgroundColor(Textdraw6, 255);
    TextDrawFont(Textdraw6, 3);
    TextDrawLetterSize(Textdraw6, 0.500000, 1.000000);
    TextDrawColor(Textdraw6, -16776961);
    TextDrawSetOutline(Textdraw6, 1);
    TextDrawSetProportional(Textdraw6, 1);
   
    for(new i; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerConnected(i))
        {
            TextDrawShowForPlayer(i, Textdraw5);
            TextDrawShowForPlayer(i, Textdraw6);
        }
    }

    TextDrawHideForAll(Textdraw6);
    TextDrawDestroy(Textdraw6);



Re: What is that ? Textdraws - AiRaLoKa - 13.06.2014

Quote:
Originally Posted by Le3aT
Посмотреть сообщение
pawn Код:
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(853) : error 033: array must be indexed (variable "Textdraw6")
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(854) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(855) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(856) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(857) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(858) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(859) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(860) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(869) : error 035: argument type mismatch (argument 2)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(887) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(888) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


11 Errors.
The code

pawn Код:
Textdraw6 = TextDrawCreate(117.000000, 330.000000, "0");
    TextDrawAlignment(Textdraw6, 2);
    TextDrawBackgroundColor(Textdraw6, 255);
    TextDrawFont(Textdraw6, 3);
    TextDrawLetterSize(Textdraw6, 0.500000, 1.000000);
    TextDrawColor(Textdraw6, -16776961);
    TextDrawSetOutline(Textdraw6, 1);
    TextDrawSetProportional(Textdraw6, 1);
   
    for(new i; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerConnected(i))
        {
            TextDrawShowForPlayer(i, Textdraw5);
            TextDrawShowForPlayer(i, Textdraw6);
        }
    }

    TextDrawHideForAll(Textdraw6);
    TextDrawDestroy(Textdraw6);
change the Textdraw6 with Textdraw6[playerid] and move it into OnPlayerConnect