Scripting a custom class selection
#1

So I have been re-working on my Minigames Script after failing miserably on using CallRemoteFunction as the main key to link all of my gamemodes (as it crashes for some reason)

I am working on a new script from scratch, I was scripting a function where in I can simply insert a new game with ease but there's a problem in the Class Selection system. I can't seem to get it working. It always gets stuck on skinID: 133 (classid: 2 = on my custom script not on the actual class selection)

PHP код:
#define             MAX_GAMES               (500)
#define             MAX_CLASSES             (6)
// Game Mode Types
#define             GAME_TDM                (1)
#define             GAME_LMS                (2)
#define             GAME_RACE               (3)
#define             GAME_TAKEOVER           (4)
#define             GAME_STEALING           (5)
#define             GAME_ZOMBIE             (6)
#define             GAME_DM                 (7)
#define             GAME_FALLOUT            (8)
#define             GAME_BOMBING            (9)
enum GameInfo
{
    
gName[32],
    
gMode,
    
gRoundTime,
    
gSkin[MAX_CLASSES],
    
Float:gSkinX[MAX_CLASSES],
    
Float:gSkinY[MAX_CLASSES],
    
Float:gSkinZ[MAX_CLASSES],
    
Float:gSkinA[MAX_CLASSES],
    
gSkinInt[MAX_CLASSES],
    
gSkinVW[MAX_CLASSES],
    
gTotalClass
};
new
    
gInfo[MAX_GAMES][GameInfo],
    
gGames,
    
currGame,
    
currSkin[MAX_PLAYERS]
;
stock CreateGame(name[], modetime)
{
    if(
gGames >= MAX_GAMES)
        return 
printf("* Can't create a new game, Has reached the (%d) limit."MAX_GAMES);
    
gGames ++;
    
format(gInfo[gGames][gName], 32name);
    
gInfo[gGames][gMode] = mode;
    
gInfo[gGames][gRoundTime] = time;
    
gInfo[gGames][gTotalClass] = 0;
    
    for(new 
iMAX_CLASSESi++)
    {
        
gInfo[gGames][gSkin][i] = -1;
        
gInfo[gGames][gSkinX][i] = -1;
        
gInfo[gGames][gSkinY][i] = -1;
        
gInfo[gGames][gSkinZ][i] = -1;
        
gInfo[gGames][gSkinA][i] = -1;
        
gInfo[gGames][gSkinInt][i] = -1;
        
gInfo[gGames][gSkinVW][i] = -1;
    }
    return 
gGames;
}
stock AddPlayerClasses(gameidskinidFloat:xFloat:yFloat:zFloat:ainteriorworld)
{
    if(
gInfo[gameid][gTotalClass] >= MAX_CLASSES)
        return 
printf("* Can't add new classes, Has reached the (%d) limit."MAX_CLASSES);
        
    
gInfo[gameid][gSkin][gInfo[gameid][gTotalClass]] = skinid;
    
gInfo[gameid][gSkinX][gInfo[gameid][gTotalClass]] = x;
    
gInfo[gameid][gSkinY][gInfo[gameid][gTotalClass]] = y;
    
gInfo[gameid][gSkinZ][gInfo[gameid][gTotalClass]] = z;
    
gInfo[gameid][gSkinA][gInfo[gameid][gTotalClass]] = a;
    
gInfo[gameid][gSkinInt][gInfo[gameid][gTotalClass]] = interior;
    
gInfo[gameid][gSkinVW][gInfo[gameid][gTotalClass]] = world;
    return 
gInfo[gameid][gTotalClass] ++;
}
public 
OnGameModeInit()
{
    
SetGameModeText("Minigames v0.01");
    
AddPlayerClass(01699.9644, -3488.900920.7700353.1400000000);
    
////////////////////////////////////////////////////////////////////////////
    
    
CreateGame("Militia Forest"GAME_TDM300);
    
// Green Team
    
AddPlayerClasses(131699.9644, -3488.900920.7700353.140000);
    
AddPlayerClasses(11331699.9644, -3488.900920.7700353.140000);
    
AddPlayerClasses(11911699.9644, -3488.900920.7700353.140000);
    
// Blue Team
    
AddPlayerClasses(12851697.8439, -3198.130618.4751184.901800);
    
printf("Total Class for %d: %d"1gInfo[1][gTotalClass]);
    
currGame 1;
    
////////////////////////////////////////////////////////////////////////////
    
return 1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
currSkin[playerid] ++;
    if(
gInfo[currGame][gTotalClass] >= currSkin[playerid])
    {
        
currSkin[playerid] = 1;
    }
    
SetPlayerSkin(playeridgInfo[currGame][gSkin][currSkin[playerid]]);
    
SetPlayerPos(playerid2495.04492773.056610.8158);
    
SetPlayerFacingAngle(playerid88.0);
    
SetPlayerCameraPos(playerid2490.95562773.132610.7968);
    
SetPlayerCameraLookAt(playerid2495.04492773.056610.8158);
    
PlayerPlaySound(playerid10682495.04492773.056610.8158);
    switch(
random(5))
    {
        case 
0ApplyAnimation(playerid"DANCING""dnce_M_a"4.110000);
        case 
1ApplyAnimation(playerid"DANCING""dnce_M_b"4.110000);
        case 
2ApplyAnimation(playerid"DANCING""dnce_M_c"4.110000);
        case 
3ApplyAnimation(playerid"DANCING""dnce_M_d"4.110000);
        case 
4ApplyAnimation(playerid"DANCING""dnce_M_e"4.110000);
    }
    return 
1;

currSkin is set to zero by default upon player connecting to the server.
Reply


Messages In This Thread
Scripting a custom class selection - by JaKe Elite - 20.12.2016, 12:37
Re: Scripting a custom class selection - by jlalt - 20.12.2016, 14:03
Re: Scripting a custom class selection - by JaKe Elite - 20.12.2016, 20:37
Re: Scripting a custom class selection - by jlalt - 21.12.2016, 04:03
Re: Scripting a custom class selection - by JaKe Elite - 24.12.2016, 00:03
Re: Scripting a custom class selection - by jlalt - 24.12.2016, 05:19
Re: Scripting a custom class selection - by Sew_Sumi - 24.12.2016, 07:51
Re: Scripting a custom class selection - by JaKe Elite - 24.12.2016, 07:56
Re: Scripting a custom class selection - by jlalt - 24.12.2016, 12:08
Re: Scripting a custom class selection - by Sew_Sumi - 24.12.2016, 13:04

Forum Jump:


Users browsing this thread: 5 Guest(s)