A bug in Y_Classes or am I doing something wrong?
#1

OK, so I was writing a simple script, and I noticed this wasn't right:
pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    if( classid == cop ) {
        gTeam[ playerid ] = TEAM_COPS;
        GameTextForPlayer( playerid, "~b~Cops", 100000, 3 );
    }
    else if( classid == fire ) {
        gTeam[ playerid ] = TEAM_FIREMEN;
        GameTextForPlayer( playerid, "~r~Firemen", 100000, 3 );
    }
    SetPlayerPos(playerid, -61.2694,-36.4542,25.9801);
    SetPlayerCameraPos(playerid, -58.7490,-28.2387,25.9801);
    SetPlayerCameraLookAt(playerid, -61.2694,-36.4542,25.9801);
    SetPlayerFacingAngle( playerid, 347.6776 );
    return 1;
}
pawn Код:
//gamemodeinit
cop = Class_Add( 280, 1958.3783, 1343.1572, 15.3746, 269.1425 );
fire = Class_Add( 279, 1958.3783, 1343.1572, 15.3746, 269.1425 );
pawn Код:
public OnPlayerConnect( playerid ) {
    Class_SetPlayer( cop, playerid, true );
    Class_SetPlayer( fire, playerid, true );
    Class_SetPlayer( cop2, playerid, false );
    Class_SetPlayer( fire2, playerid, false );
    return 1;
}
What happens is the if( classid == ... ) doesn't get called correctly. For example, I click left or right button a few times in the class selection, and I will get "firemen" on the cop, etc.

How can I fix this?
Reply
#2

Bump...
Reply
#3

Bump.
Reply
#4

Shouldn't it be like this XD?

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(gTeam[playerid] == TEAM_COPS)
    {
        GameTextForPlayer(playerid, "~b~Cops", 100000, 3);
    }
    else if(gTeam[playerid] == TEAM_FIREMEN)
    {
        GameTextForPlayer(playerid, "~r~Firemen", 100000, 3);
    }
    SetPlayerPos(playerid, -61.2694,-36.4542,25.9801);
    SetPlayerCameraPos(playerid, -58.7490,-28.2387,25.9801);
    SetPlayerCameraLookAt(playerid, -61.2694,-36.4542,25.9801);
    SetPlayerFacingAngle( playerid, 347.6776 );
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)