20.12.2016, 12:37
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)
currSkin is set to zero by default upon player connecting to the server.
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[], mode, time)
{
if(gGames >= MAX_GAMES)
return printf("* Can't create a new game, Has reached the (%d) limit.", MAX_GAMES);
gGames ++;
format(gInfo[gGames][gName], 32, name);
gInfo[gGames][gMode] = mode;
gInfo[gGames][gRoundTime] = time;
gInfo[gGames][gTotalClass] = 0;
for(new i; i < MAX_CLASSES; i++)
{
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(gameid, skinid, Float:x, Float:y, Float:z, Float:a, interior, world)
{
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(0, 1699.9644, -3488.9009, 20.7700, 353.1400, 0, 0, 0, 0, 0, 0);
////////////////////////////////////////////////////////////////////////////
CreateGame("Militia Forest", GAME_TDM, 300);
// Green Team
AddPlayerClasses(1, 3, 1699.9644, -3488.9009, 20.7700, 353.1400, 0, 0);
AddPlayerClasses(1, 133, 1699.9644, -3488.9009, 20.7700, 353.1400, 0, 0);
AddPlayerClasses(1, 191, 1699.9644, -3488.9009, 20.7700, 353.1400, 0, 0);
// Blue Team
AddPlayerClasses(1, 285, 1697.8439, -3198.1306, 18.4751, 184.9018, 0, 0);
printf("Total Class for %d: %d", 1, gInfo[1][gTotalClass]);
currGame = 1;
////////////////////////////////////////////////////////////////////////////
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
currSkin[playerid] ++;
if(gInfo[currGame][gTotalClass] >= currSkin[playerid])
{
currSkin[playerid] = 1;
}
SetPlayerSkin(playerid, gInfo[currGame][gSkin][currSkin[playerid]]);
SetPlayerPos(playerid, 2495.0449, 2773.0566, 10.8158);
SetPlayerFacingAngle(playerid, 88.0);
SetPlayerCameraPos(playerid, 2490.9556, 2773.1326, 10.7968);
SetPlayerCameraLookAt(playerid, 2495.0449, 2773.0566, 10.8158);
PlayerPlaySound(playerid, 1068, 2495.0449, 2773.0566, 10.8158);
switch(random(5))
{
case 0: ApplyAnimation(playerid, "DANCING", "dnce_M_a", 4.1, 1, 0, 0, 0, 0);
case 1: ApplyAnimation(playerid, "DANCING", "dnce_M_b", 4.1, 1, 0, 0, 0, 0);
case 2: ApplyAnimation(playerid, "DANCING", "dnce_M_c", 4.1, 1, 0, 0, 0, 0);
case 3: ApplyAnimation(playerid, "DANCING", "dnce_M_d", 4.1, 1, 0, 0, 0, 0);
case 4: ApplyAnimation(playerid, "DANCING", "dnce_M_e", 4.1, 1, 0, 0, 0, 0);
}
return 1;
}