AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ HELP ] Turn the remaining players into... (https://forums.alliedmods.net/showthread.php?t=275201)

CrazY. 11-24-2015 13:37

[ HELP ] Turn the remaining players into...
 
I have a little problem in the following code:
Code:
else if ((mode == MODE_NONE && (!get_pcvar_num(cvar_preventconsecutive) || g_lastmode != MODE_NIGHTMARE) && random_num(1, get_pcvar_num(cvar_nightchance)) == get_pcvar_num(cvar_night) && floatround(iPlayersnum*get_pcvar_float(cvar_nightratio), floatround_ceil) >= 2 && floatround(iPlayersnum*get_pcvar_float(cvar_nightratio), floatround_ceil) < iPlayersnum && iPlayersnum >= get_pcvar_num(cvar_nightminplayers)) || mode == MODE_NIGHTMARE)     {         // Nightmare Mode         g_nightround = true         g_lastmode = MODE_NIGHTMARE                 // iMaxZombies is rounded up, in case there aren't enough players         iMaxZombies = floatround(iPlayersnum*get_pcvar_float(cvar_nightratio), floatround_ceil)         iZombies = 0         // Randomly turn iMaxZombies players into nemesis         while (iZombies < iMaxZombies)         {             // Keep looping through all players             if (++id > g_maxplayers) id = 1                         // Dead or already a nemesis             if (!g_isalive[id] || g_nemesis[id])                 continue;                         // Random chance             if (random_num(0, 1))             {                 // Turn into a nemesis                 zombieme(id, 0, 1, 0, 0, 0)                 iZombies++                 // Apply nemesis health                 fm_set_user_health(id, get_pcvar_num(cvar_nightnemhp))             }         }         iZombies = 0         // Randomly turn iMaxZombies players into survivor         while (iZombies < iMaxZombies)         {             // Keep looping through all players             if (++id > g_maxplayers) id = 1                         // Dead or already a survivor             if (!g_isalive[id] || g_survivor[id])                 continue;                         // Random chance             if (random_num(0, 1))             {                 // Turn into a survivor                 humanme(id, 1, 0, 0)                 iZombies++                 // Apply survivor health                 fm_set_user_health(id, get_pcvar_num(cvar_nightsurvhp))             }         }         iZombies = 0         // Randomly turn iMaxZombies players into assassin         while (iZombies < iMaxZombies)         {             // Keep looping through all players             if (++id > g_maxplayers) id = 1                         // Dead or already a assassin             if (!g_isalive[id] || g_assassin[id])                 continue;                         // Random chance             if (random_num(0, 1))             {                 // Turn into a assassin                 zombieme(id, 0, 0, 1, 0, 0)                 iZombies++                 // Apply assassin health                 fm_set_user_health(id, get_pcvar_num(cvar_nightassahp))             }         }         // Turn the remaining players into snipers         for (id = 1; id <= g_maxplayers; id++)         {             // Only those of them who aren't nemesis/assassin/survivor/sniper             if (!g_isalive[id] || g_nemesis[id] || g_assassin[id] || g_survivor[id] || g_sniper[id])                 continue;             // If not, turn him into one             humanme(id, 0, 1, 0)                         // Apply sniper health             fm_set_user_health(id, get_pcvar_num(cvar_nightsniphp))         }                 // Play nightmare sound         ArrayGetString(sound_nightmare, random_num(0, ArraySize(sound_nightmare) - 1), sound, charsmax(sound))         PlaySound(sound);                 // Show Nightmare HUD notice         set_hudmessage(255, 20, 20, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)         ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_NIGHTMARE")                 // Mode fully started!         g_modestarted = true                 // Round start forward         ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_NIGHTMARE, 0);     }

A basic example, 20 players on the server, so if this start, every 5 of these 20 players have to turn a different class (nemesis , survivor , assassin , sniper), the problem is that this does not happen, how can I fix?


All times are GMT -4. The time now is 17:59.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.