OnPlayerRequestClass > PROBLEM
#1

https://pastebin.com/sYSTyxKe


I tried everything but It won't work,

I can only choose the Army Fraction, even if I am swat, nothing works
Reply
#2

Your code has error?
Reply
#3

no code is error-free
Reply
#4

You should consider doing it like this
PHP код:
public OnGameModeInit(){
    
AddPlayerClassEx(131275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(161275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(1171275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(1191275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(1211275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(1231275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(1281275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(1291275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(1371275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(1461275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(1491275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(1911275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(11381275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(11401275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(12331275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(23001275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(23011275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(23021275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(23061275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(23071275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(23091275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(23101275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(22831275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(22881275.7145,-790.4781,1089.9375,206.3436000000);
    
AddPlayerClassEx(32851275.7145,-790.4781,1089.9375,206.3436000000);           
    
AddPlayerClassEx(42871275.7145,-790.4781,1089.9375,206.3436000000);
    
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid){
    
SetPlayerInterior(playerid,5);
    
SetPlayerPos(playerid,1275.7145,-790.4781,1089.9375);
    
SetPlayerCameraPos(playerid,1277.1993,-793.9561,1089.9375);
    
SetPlayerCameraLookAt(playerid,1275.7145,-790.4781,1089.9375);
    
ApplyAnimation(playerid"DANCING""DAN_Left_A"2.1110111);
    
SetPlayerFacingAngle(playerid,270.5306);
    
    switch(
classid){
        case 
1:{
            
format(stringsizeof(string), "~y~> ~p~Civilian ~y~<");
            
GameTextForPlayer(playerid,string,3500,6);        
        }
        case 
2:{
            
format(stringsizeof(string), "~b~> ~p~Cops ~b~<");
            
GameTextForPlayer(playerid,string,3500,6);    
        }
        case 
3:{
            
format(stringsizeof(string), "~b~> ~p~SWAT ~b~<");
            
GameTextForPlayer(playerid,string,3500,6);
        }
        case 
4:{
            
format(stringsizeof(string), "~b~> ~p~ARMY ~b~<");
            
GameTextForPlayer(playerid,string,3500,6);
        }
    }
    return 
1;
}
public 
OnPlayerRequestSpawn(playerid){
    new 
GetPlayerTeam(playerid);
    if(
PlayerInfo[playerid][FracID] != && == 3){
        
SendClientMessage(playerid, -1"You cannot select SWAT team because ............");
        return 
0;
    }    
    if(
PlayerInfo[playerid][FracID] != && == 4){
        
SendClientMessage(playerid, -1"You cannot select ARMY team because ............");
        return 
0;
    } 
    return 
1;

I am sure it will work, but you will have to edit gametexts.
You were adding classes everytime a player was in team selection (requesting class).
Reply
#5

thx very much +rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)