24.07.2016, 05:46
This will help you out:
Don't just copy/paste.
pawn Код:
// ** INCLUDES
#include <a_samp>
// ** DEFINES
// *** TEAMS
#define TEAM_HUMAN 0
#define TEAM_ZOMBIE 1
// ** VARIABLES
// *** GLOBAL VARIABLES
// **** GENERAL
new gPlayerCount,
gPlayerIDs[MAX_PLAYERS];
// *** PER-PLAYER VARIABLES
// **** GENERAL
new pTeam[MAX_PLAYERS];
// ** MAIN
main()
{
print("Loaded \"make_players_humans_and_zombies.amx\".");
gPlayerCount = 8;
new human_count, zombie_count, count, selected;
GetHumanAndZombieCount(human_count, zombie_count);
printf("%d human(s), %d zombie(s)", human_count, zombie_count);
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i ++)
{
if(!IsPlayerConnected(i))
{
continue;
}
gPlayerIDs[count ++] = i;
pTeam[playerid] = TEAM_HUMAN;
}
for(new i = 0; i < zombie_count; i ++)
{
selected = random(count);
pTeam[gPlayerIDs[selected]] = TEAM_ZOMBIE;
gPlayerIDs[selected] = gPlayerIDs[count - 1];
count --;
}
}
// ** CALLBACKS
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
// ** FUNCTIONS
stock GetHumanAndZombieCount(&human_count, &zombie_count)
{
zombie_count = floatround((gPlayerCount / 2), floatround_floor);
human_count = (gPlayerCount - zombie_count);
return 1;
}