TextDrawSetString
#1

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);
}
Reply
#2

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
Reply
#3

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

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.
Reply
#5

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);
}
Reply
#6

Because you try to print an integer in %s.
Reply
#7

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
Reply
#8

pawn Код:
return 1;
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 6 Guest(s)