gametext delays on class selection
#1

Ok here is the problem i setting up teams, and im using gametext to tell which team the skin that you are looking at if related to but it keeps delaying .For example im looking at a police skin(which is related to team police) but the game text will delay and say im looking at grove family.

In this image im looking at a team grove player but it says ballas familia.



pawn Код:
forward SetPlayerTeamFromClass(playerid, classid);
public SetPlayerTeamFromClass(playerid, classid)
{
    switch(classid)
    {
        case 0:
        {
            gTeam[playerid] = BALLAS;
            GameTextForPlayer(playerid,"~p~ Ballas Familia",1000,1);
            SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909);
            SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerFacingAngle(playerid,122.4500);
            SetPlayerColor(playerid,BCOL);
        }
        case 1:
        {
            gTeam[playerid] = BALLAS;
            GameTextForPlayer(playerid,"~p~ Ballas Familia",1000,1);
            SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909);
            SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerFacingAngle(playerid,122.4500);
            SetPlayerColor(playerid,BCOL);
        }
        case 2:
        {
            gTeam[playerid] = BALLAS;
            GameTextForPlayer(playerid,"~p~ Ballas Familia",1000,1);
            SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909);
            SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerFacingAngle(playerid,122.4500);
            SetPlayerColor(playerid,BCOL);
        }
        case 3:
        {
            gTeam[playerid] = BALLAS;
            GameTextForPlayer(playerid,"~p~ Ballas Familia",1000,1);
            SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909);
            SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerFacingAngle(playerid,122.4500);
            SetPlayerColor(playerid,BCOL);
        }
        case 4:
        {
            gTeam[playerid] = BALLAS;
            GameTextForPlayer(playerid,"~p~ Ballas Familia",1000,1);
            SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909);
            SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerFacingAngle(playerid,122.4500);
            SetPlayerColor(playerid,BCOL);
        }
        case 5:
        {
            gTeam[playerid] = BALLAS;
            GameTextForPlayer(playerid,"~p~ Ballas Familia",1000,1);
            SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909);
            SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerFacingAngle(playerid,122.4500);
            SetPlayerColor(playerid,BCOL);
        }
        case 6:
        {
            gTeam[playerid] = GROVES;
            GameTextForPlayer(playerid,"~g~Grove Street Familia",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,GCOL);
        }
        case 7:
        {
            gTeam[playerid] = GROVES;
            GameTextForPlayer(playerid,"~g~Grove Street Familia",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,GCOL);
        }
        case 8:
        {
            gTeam[playerid] = GROVES;
            GameTextForPlayer(playerid,"~g~Grove Street Familia",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,GCOL);
        }
        case 9:
        {
            gTeam[playerid] = GROVES;
            GameTextForPlayer(playerid,"~g~Grove Street Familia",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,GCOL);
        }
        case 10:
        {
            gTeam[playerid] = GROVES;
            GameTextForPlayer(playerid,"~g~Grove Street Familia",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,GCOL);
        }
        case 11:
        {
            gTeam[playerid] = GROVES;
            GameTextForPlayer(playerid,"~g~Grove Street Familia",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,GCOL);
        }
        case 12:
        {
            gTeam[playerid] = POLICE;
            GameTextForPlayer(playerid,"~b~Los Santos Police (L.S.P)",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,PCOL);
        }
        case 13:
        {
            gTeam[playerid] = POLICE;
            GameTextForPlayer(playerid,"~b~Los Santos Police (L.S.P)",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,PCOL);
        }
        case 14:
        {
            gTeam[playerid] = POLICE;
            GameTextForPlayer(playerid,"~b~Los Santos Police (L.S.P)",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,PCOL);
        }
        case 15:
        {
            gTeam[playerid] = POLICE;
            GameTextForPlayer(playerid,"~b~Los Santos Police (L.S.P)",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,PCOL);
        }
        case 16:
        {
            gTeam[playerid] = POLICE;
            GameTextForPlayer(playerid,"~b~Los Santos Police (L.S.P)",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,PCOL);
        }
        case 17:
        {
            gTeam[playerid] = POLICE;
            GameTextForPlayer(playerid,"~b~Los Santos Police (L.S.P)",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,PCOL);
        }
    }
    return 1;
}
Reply
#2

Take a look at this:

https://sampwiki.blast.hk/wiki/GameTextStyle

Type 1 fades out after 8 seconds regardless of time set. Look into using textdraws instead, or chose a different style that you can control the time of.

Also, to help you out on your cases cause it seems like you repeat a lot of code, you can do this to have a more efficent code:

pawn Код:
forward SetPlayerTeamFromClass(playerid, classid);
public SetPlayerTeamFromClass(playerid, classid)
{
    switch(classid)
    {
        case 0 .. 5: // classid 0-5
        {
            gTeam[playerid] = BALLAS;
            GameTextForPlayer(playerid,"~p~ Ballas Familia",1000,1);
            SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909);
            SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
            SetPlayerFacingAngle(playerid,122.4500);
            SetPlayerColor(playerid,BCOL);
        }
        case 6 .. 11: // classid 6-11
        {
            gTeam[playerid] = GROVES;
            GameTextForPlayer(playerid,"~g~Grove Street Familia",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,GCOL);
        }
        case 12 .. 17: // classid 12-17
        {
            gTeam[playerid] = POLICE;
            GameTextForPlayer(playerid,"~b~Los Santos Police (L.S.P)",1000,1);
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            SetPlayerColor(playerid,PCOL);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)