TextDrawSetString works only for ID 0..
#1

Okay, I've seen that the TextDrawSetString is bugging to me.
It's working to ID 0 but in the rest of the IDs it's not.
I tried everything to fix it but that was with no effect..

This is my code:

pawn Код:
new Text:WantedTimer[MAX_PLAYERS];
pawn Код:
public OnPlayerConnect(playerid)
{
    WantedTimer[playerid] = TextDrawCreate(505.000000, 411.000000, "Time left: 0");
    return 1;
}
pawn Код:
WantedTime[ID] = GetPlayerWantedLevel(ID) * 10;  //That's from some command that I created.
pawn Код:
forward WantedVariables();
public WantedVariables()
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new string[128];
            new pname[24];
            GetPlayerName(i,pname,sizeof(pname));

            if(GetPlayerWeapon(i) != 0)
            {
                if(WantedTime[i] >= 1)
                {
                    ResetPlayerWeapons(i);
                }
            }

            if(WantedTime[i] > 1)
            {
                format(string,sizeof(string),"Time left: %d",WantedTime);
                TextDrawSetString(Text:WantedTimer[i], string);

                WantedTime[i] --;
            }
            if(WantedTime[i] == 1)
            {
                format(string,sizeof(string),""COL_YELLOW"[JAIL] "COL_WHITE"%s(%d) has been released from the jail, "COL_REASON"reason: Served his sentence.",pname,i);
                SendClientMessageToAll(COLOR_ORANGE,string);
                format(string,sizeof(string),"7[JAIL]%s(%d) has been released from the jail, reason: Served his sentence.",pname,i);

                TotalWantedTime[i] =0;
                WantedTime[i] =0;
                TextDrawHideForPlayer(i,WantedTimer[i]);

                SetPlayerPos(i,225.8451,112.8976,1003.2188);
                SetPlayerFacingAngle(i,1.0816);
                SetCameraBehindPlayer(i);
            }
        }
    }
    return 1;
}

What's the problem with that guys?
Please help me to fix it..
Reply
#2

UP
Please help me guys....
Reply
#3

wher did you placed this code
pawn Код:
WantedTime[ID] = GetPlayerWantedLevel(ID) * 10;  //That's from some command that I created.
Reply
#4

Here,

pawn Код:
dcmd_arrest(playerid,params[]) //This is the not the full code. There is more commands (if etc. ..) but it is not necessary right now.
{
    new string[128];
    new ID;
    if(GetDistanceBetweenPlayers(playerid,ID) <= 4)
    {
        IncreasePlayerScore(playerid,2);

        TextDrawShowForPlayer(ID,WantedTimer[ID]);

        ResetPlayerWeapons(ID);

        if(GetPlayerWantedLevel(ID) >= 6)
        {
            new wanted;
            wanted = GetPlayerWantedLevel(ID) * 200;
            new wantedtime;
            wantedtime = GetPlayerWantedLevel(ID) * 10;
            GivePlayerMoney(playerid,wanted);
            format(string,sizeof(string),""COL_POLICE"[POLICE] "COL_WHITE"%s(%d) has sent the suspect %s to the jail for: %d.",PlayerName(playerid),playerid,PlayerName(ID),wantedtime);
            SendClientMessageToAll(COLOR_ORANGE,string);
            format(string,sizeof(string),"7[POLICE] %s(%d) has sent the suspect %s to the jail for: %d.",PlayerName(playerid),playerid,PlayerName(ID),wantedtime);
            IRC_GroupSay(gGroupID,IRC_CHANNEL,string);

            format(string,sizeof(string),""COL_GREEN"[POLICE] "COL_WHITE"You have recieved "COL_YELLOW"$%d "COL_WHITE"for sending the suspect "COL_YELLOW"%s "COL_WHITE"to the jail.",wanted,PlayerName(ID));
            SendClientMessage(playerid,COLOR_LIGHTBLUE,string);

            new Float:x, Float:y, Float:z;
            GetPlayerPos(ID, x,y,z);
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                for(new d=0; d<MAX_PLAYER_ATTACHED_OBJECTS; d++)
                {
                    if(IsPlayerAttachedObjectSlotUsed(i, d)) RemovePlayerAttachedObject(i, d);
                    SetPlayerSpecialAction(i, SPECIAL_ACTION_NONE);
                }
            }
            new rnd = random(sizeof(JailSpawnPoints));
            TotalWantedTime[ID] = GetPlayerWantedLevel(ID) * 10;
            WantedTime[ID] = GetPlayerWantedLevel(ID) * 10;
            IsTazed[ID] =0;
            TazeTime[ID] =0;
            IsCuffed[ID] =0;
            CuffTime[ID] =0;
            SetPlayerInterior(ID,10);
            SetPlayerPos(ID,JailSpawnPoints[rnd][0],JailSpawnPoints[rnd][1],JailSpawnPoints[rnd][2]);
            SetPlayerFacingAngle(ID,JailSpawnPoints[rnd][3]);
            TogglePlayerControllable(ID,1);
            ClearAnimations(ID);
            SetPlayerWantedLevel(ID,0);
            SetPlayerToTeamColour(ID);
            SetPlayerHealth(ID,999999);
            return 1;
        }
        return 1;
    }
    return 1;
}
Reply
#5

Код:
WantedTime[ID] = GetPlayerWantedLevel(ID) * 10;
You replace textdraw id w/ another value
Reply
#6

Quote:
Originally Posted by ReVo_
Посмотреть сообщение
Код:
WantedTime[ID] = GetPlayerWantedLevel(ID) * 10;
You replace textdraw id w/ another value
Then how to fix that?
Reply
#7

just remove the line
Reply
#8

pawn Код:
WantedTime[ID] = GetPlayerWantedLevel(ID) * 10;
This line is the time on the jail.
It's have to be there...
Reply
#9

so use another variable to store textdraw id.
You cannot store two different things in a variable, lul.
Reply
#10

Quote:
Originally Posted by ReVo_
Посмотреть сообщение
so use another variable to store textdraw id.
You cannot store two different things in a variable, lul.
Can you show me how to do it?
btw, thanks for helping me.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)