What is wrong with my code? (PlayerTextDrawColor)
#1

Problem :
In cS_Update. The color i want not set. what is the problem? i got no error and warning on compile.
Screenshot :
[img width=500 height=500]http://i.imgur.com/EiTzl6V.jpg[/img]
Click on it for more resolution

Code :

The FS:
pawn Код:
#include <a_samp>
#include <cS>

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPosEx(playerid, 2488.6768, -1667.1785, 13.3438, 200.0000);
    SetPlayerCameraPos(playerid, 2490.5000, -1674.6300, 17.5500);
    SetPlayerCameraLookAt(playerid, 2488.6768, -1667.1785, 13.3438);

    if(!gcSDisplayed[playerid]) {
    cS_Show(playerid); }
    if(gcSDisplayed[playerid])
    {
        switch(classid)
        {
            case 0:
            {
                cS_Update(playerid, 0xCD0000FF, "Ballas", "~r~~h~]~s~ has access to many features~n~~y~~h~]~s~ has access to many features~n~~p~~h~]~s~ can put c4~n~~g~~h~]~s~ test~n~");
            }
            case 1:
            {
                cS_Update(playerid, 0x00CD00FF, "GSF", "~r~~h~]~s~ test one~n~~y~~h~]~s~ has access to many features~n~~p~~h~]~s~ can put c4~n~~g~~h~]~s~ test~n~");
            }
            case 2:
            {
                cS_Update(playerid, 0x0000CDFF, "LSV", "~r~~h~]~s~ test two~n~~y~~h~]~s~ has access to many features~n~~p~~h~]~s~ can put c4~n~~g~~h~]~s~ test~n~");
            }
        }
    }
   
    return 1;
}
** The include
pawn Код:
new PlayerText:gcSTeamName[MAX_PLAYERS];
new PlayerText:gcSClassInfoHeader[MAX_PLAYERS];
new PlayerText:gcSClassInfo[MAX_PLAYERS];
new gcSDisplayed[MAX_PLAYERS];

/**
 * Shows the class selection information text draws for a player.
 * @param int playerid The player ID To show Text draws for him.
 */

stock cS_Show(playerid)
{
    PlayerTextDrawShow(playerid, gcSTeamName[playerid]);
    PlayerTextDrawShow(playerid, gcSClassInfoHeader[playerid]);
    PlayerTextDrawShow(playerid, gcSClassInfo[playerid]);
    gcSDisplayed[playerid] = 1;
}

/**
 * Hides the class selection information text draws for a player.
 * @param int playerid The player ID To Hide Text draws for him.
 */

stock cS_Hide(playerid)
{
    PlayerTextDrawHide(playerid, gcSTeamName[playerid]);
    PlayerTextDrawHide(playerid, gcSClassInfoHeader[playerid]);
    PlayerTextDrawHide(playerid, gcSClassInfo[playerid]);
    gcSDisplayed[playerid] = 0;
}

/**
 * @param int playerid The player Id to update for
 * @param int color The color of the Team name string
 * @param string teamName[] The team name string to set
 * @return string cInfo[] the class information string to set
 */

stock cS_Update(playerid, color, teamName[], cInfo[])
{
    if(gcSDisplayed[playerid])
    {
        PlayerTextDrawSetString(playerid, gcSTeamName[playerid], teamName);
        PlayerTextDrawSetString(playerid, gcSClassInfo[playerid], cInfo);
        PlayerTextDrawColor(playerid, gcSTeamName[playerid], color);
    }
}

public OnPlayerConnect(playerid)
{
    gcSTeamName[playerid] = CreatePlayerTextDraw(playerid, 110.000000, 145.000000, "_");
    PlayerTextDrawAlignment(playerid, gcSTeamName[playerid], 2);
    PlayerTextDrawBackgroundColor(playerid, gcSTeamName[playerid], 255);
    PlayerTextDrawFont(playerid, gcSTeamName[playerid], 1);
    PlayerTextDrawLetterSize(playerid, gcSTeamName[playerid], 0.500000, 2.000000);
    PlayerTextDrawColor(playerid, gcSTeamName[playerid], -1);
    PlayerTextDrawSetOutline(playerid, gcSTeamName[playerid], 1);
    PlayerTextDrawSetProportional(playerid, gcSTeamName[playerid], 1);
    PlayerTextDrawSetSelectable(playerid, gcSTeamName[playerid], 0);
   
    gcSClassInfoHeader[playerid] = CreatePlayerTextDraw(playerid, 110.000000, 170.000000, "| CLASS INFORMATION |");
    PlayerTextDrawAlignment(playerid, gcSClassInfoHeader[playerid], 2);
    PlayerTextDrawBackgroundColor(playerid, gcSClassInfoHeader[playerid], 255);
    PlayerTextDrawFont(playerid, gcSClassInfoHeader[playerid], 2);
    PlayerTextDrawLetterSize(playerid, gcSClassInfoHeader[playerid], 0.300000, 1.000000);
    PlayerTextDrawColor(playerid, gcSClassInfoHeader[playerid], -1);
    PlayerTextDrawSetOutline(playerid, gcSClassInfoHeader[playerid], 1);
    PlayerTextDrawSetProportional(playerid, gcSClassInfoHeader[playerid], 1);
    PlayerTextDrawUseBox(playerid, gcSClassInfoHeader[playerid], 1);
    PlayerTextDrawBoxColor(playerid, gcSClassInfoHeader[playerid], 35712);
    PlayerTextDrawTextSize(playerid, gcSClassInfoHeader[playerid], 0.000000, 200.000000);
    PlayerTextDrawSetSelectable(playerid, gcSClassInfoHeader[playerid], 0);
   
    gcSClassInfo[playerid] = CreatePlayerTextDraw(playerid, 10.000000, 183.500000, "] has access to hq~n~] can plant bomb on grove~n~] can team up with rifa, russian mafia and vagos");
    PlayerTextDrawBackgroundColor(playerid, gcSClassInfo[playerid], 255);
    PlayerTextDrawFont(playerid, gcSClassInfo[playerid], 2);
    PlayerTextDrawLetterSize(playerid, gcSClassInfo[playerid], 0.200000, 1.000000);
    PlayerTextDrawColor(playerid, gcSClassInfo[playerid], -1);
    PlayerTextDrawSetOutline(playerid, gcSClassInfo[playerid], 1);
    PlayerTextDrawSetProportional(playerid, gcSClassInfo[playerid], 1);
    PlayerTextDrawUseBox(playerid, gcSClassInfo[playerid], 1);
    PlayerTextDrawBoxColor(playerid, gcSClassInfo[playerid], 128);
    PlayerTextDrawTextSize(playerid, gcSClassInfo[playerid], 210.000000, 0.000000);
    PlayerTextDrawSetSelectable(playerid, gcSClassInfo[playerid], 0);
   
    gcSDisplayed[playerid] = 0;
   
    return CallLocalFunction("CS_OPC", "i", playerid);
}

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect CS_OPC

forward CS_OPC(playerid);

public OnPlayerDisconnect(playerid, reason)
{
    gcSDisplayed[playerid] = 0;
    return CallLocalFunction("CS_OPD", "ii", playerid, reason);
}

#if defined _ALS_OnPlayerDisconnect
    #undef OnPlayerDisconnect
#else
    #define _ALS_OnPlayerDisconnect
#endif
#define OnPlayerDisconnect CS_OPD

forward CS_OPD(playerid, reason);
Reply
#2

bump
Reply
#3

BUMP
Reply
#4

Stop bumping really? You're even breaking the rules, you can only bump your thread once in a day. Nobody will help you like that.

Try putting "cS_Show(playerid);" after updating your colours.
Reply
#5

Why do you say that there is a problem with the code?Its not with it,it's with you,you didnt code that propely.
Reply
#6

Quote:
Originally Posted by iZN
Посмотреть сообщение
Stop bumping really? You're even breaking the rules, you can only bump your thread once in a day. Nobody will help you like that.

Try putting "cS_Show(playerid);" after updating your colours.
That worked for me! thanks!
i put this after the updates!
pawn Код:
cS_Hide(playerid);
                cS_Show(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)