SA-MP Forums Archive
TextDrawSetString - 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: TextDrawSetString (/showthread.php?tid=481536)



TextDrawSetString - AnonScripter - 16.12.2013

hey all, i made a command for showing player's inventory, but when he type the command it doesn't show his skill,
can somebody tell me what's wrong of this:

pawn Код:
#define Rapist 1

forward UpdateInventory(playerid);
public UpdateInventory(playerid)
{
    new string[128];
    new pskill[MAX_PLAYERS char];

    if(PlayerInfo[playerid][pSkill] == 1)
    {
        pskill[playerid] = Rapist;
    }

    format(string, sizeof string, "Skill: %s", pskill);
    TextDrawSetString(InvList, string);
}



Re: TextDrawSetString - Sawalha - 16.12.2013

Quote:
Originally Posted by AnonScripter
Посмотреть сообщение
hey all, i made a command for showing player's inventory, but when he type the command it doesn't show his skill,
can somebody tell me what's wrong of this:

pawn Код:
#define Rapist 1

forward UpdateInventory(playerid);
public UpdateInventory(playerid)
{
    new string[128];
    new pskill[MAX_PLAYERS char];

    if(PlayerInfo[playerid][pSkill] == 1)
    {
        pskill[playerid] = Rapist;
    }

    format(string, sizeof string, "Skill: %s", pskill);
    TextDrawSetString(InvList, string);
}
you're messing TextDrawShowForPlayer


Re: TextDrawSetString - ]Rafaellos[ - 16.12.2013

pawn Код:
new pskill[MAX_PLAYERS char];
This should be global. Is the textdraw for every player too?


Re: TextDrawSetString - Zex Tan - 16.12.2013

I don't really get what you mean, but possible reason.

#1 - You have not show the textdraw to the player.
#2 - Maybe you're talking about the skill that was about to show at %s right? First, you should change the pskill with a string in it, afterwards remove the "define Rapist 1". That should work well.


Re: TextDrawSetString - AnonScripter - 16.12.2013

okay this is the full code:
it shows only the "pDrugs" and "pSeeds" because it's digits (%i)
but the skill doesn't show anything because it's (%s) because i don't want it as digits.

all this topic is talking about how to make TextDrawSetString to show strings as letters not digits.
or how to make it work for (%s) ??

pawn Код:
public OnGameModeInit()
{
    InvList = TextDrawCreate(27.500000, 181.999984, " ");
    TextDrawLetterSize(InvList, 0.396874, 1.191666);
    TextDrawAlignment(InvList, 1);
    TextDrawColor(InvList, -1);
    TextDrawSetShadow(InvList, 0);
    TextDrawSetOutline(InvList, 1);
    TextDrawBackgroundColor(InvList, 51);
    TextDrawFont(InvList, 1);
    TextDrawSetProportional(InvList, 1);
    return 1;
}

CMD:inv(playerid, params[])
{
    TextDrawShowForPlayer(playerid, InvList);
    return 1;
}
   
forward UpdateInventory(playerid);
public UpdateInventory(playerid)
{
    new string[128];
    new pskill[MAX_PLAYERS char];
   
    if(PlayerInfo[playerid][pSkill] == 1)
    {
        pskill[playerid] = Rapist;
    }

    format(string, sizeof string, "Skill: %s~n~Drugs: %i~n~Seeds: %i", pskill, PlayerInfo[playerid][pDrugs], PlayerInfo[playerid][pSeeds]);
    TextDrawSetString(InvList, string);
}



Re: TextDrawSetString - ]Rafaellos[ - 16.12.2013

Because you try to print an integer in %s.


Re: TextDrawSetString - AnonScripter - 16.12.2013

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
Because you try to print an integer in %s.
i don't want it as integer, i want it as letters.

if the player is Rapist skill, the skill line will show "RAPIST" or "KIDNAPPER" bla bla bla
i dont want it as INTEGER.

how to use TextDrawSetString for not INTEGERS


Re: TextDrawSetString - newbie scripter - 16.12.2013

pawn Код:
return 1;



Re: TextDrawSetString - AnonScripter - 16.12.2013

Quote:
Originally Posted by newbie scripter
Посмотреть сообщение
pawn Код:
return 1;
-_-'


Re: TextDrawSetString - newbie scripter - 16.12.2013

Quote:
Originally Posted by AnonScripter
Посмотреть сообщение
-_-'
Did u try “-__-”