16.10.2011, 19:01
OK, so I was writing a simple script, and I noticed this wasn't right:
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?
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;
}
How can I fix this?