#include <a_samp>
#define Round_MaxTime 360000
#define TEAM_HUMAN 0
#define TEAM_ZOMBIE 1
#define COLOR_HUMAN 0x6495EDAA
#define COLOR_ZOMBIE 0x275511FF
#define WEAPON1_HUMAN 24
#define WEAPON2_HUMAN 25
#define WEAPON3_HUMAN 31
#define WEAPON1_ZOMBIE 4
#define WEAPON2_ZOMBIE 0
#define WEAPON3_ZOMBIE 0
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREEN 0x66CC99AA
enum aInfo
{
HumansCount,
ZombiesCount,
HumansKills,
ZombiesKills,
ID
};
enum pInfo
{
TotalCount,
Team
};
new Arena[aInfo];
new PlayerCount;
new PlayerTeam[MAX_PLAYERS];
new Text[256];
new Float:OldHP[MAX_PLAYERS];
forward AnnounceWinner();
forward ChangeRound();
forward OnPlayerUpdate(playerid);
stock HumanTeam(playerid)
{
SendClientMessage(playerid,COLOR_HUMAN,"Save the society!");
GivePlayerWeapon(playerid,WEAPON1_HUMAN,9999);
GivePlayerWeapon(playerid,WEAPON2_HUMAN,9999);
GivePlayerWeapon(playerid,WEAPON3_HUMAN,9999);
SetPlayerColor(playerid,COLOR_HUMAN);
SetPlayerTeam(playerid,0);
SetPlayerArmour(playerid,100);
SetPlayerSkin(playerid,285);
}
stock ZombieTeam(playerid)
{
ResetPlayerWeapons(playerid);
SetPlayerArmour(playerid,0);
SetPlayerSkin(playerid,162);
SendClientMessage(playerid,COLOR_ZOMBIE,"Eat some brains!");
GivePlayerWeapon(playerid,WEAPON1_ZOMBIE,9999);
GivePlayerWeapon(playerid,WEAPON2_ZOMBIE,9999);
GivePlayerWeapon(playerid,WEAPON3_ZOMBIE,9999);
SetPlayerColor(playerid,COLOR_ZOMBIE);
SetPlayerTeam(playerid,1);
SetPlayerHealth(playerid,50);
TogglePlayerControllable(playerid,1);
}
public OnGameModeInit()
{
AddPlayerClass(287,0.0,0.0,5.0,0.0,0,0,0,0,0,0);
AddPlayerClass(70,0.0,0.0,5.0,0.0,0,0,0,0,0,0);
AddPlayerClass(33,0.0,0.0,5.0,0.0,0,0,0,0,0,0);
AddPlayerClass(285,0.0,0.0,5.0,0.0,0,0,0,0,0,0);
AddPlayerClass(162,0.0,0.0,5.0,0.0,0,0,0,0,0,0);
AddPlayerClass(158,0.0,0.0,5.0,0.0,0,0,0,0,0,0);
AddPlayerClass(159,0.0,0.0,5.0,0.0,0,0,0,0,0,0);
AddPlayerClass(160,0.0,0.0,5.0,0.0,0,0,0,0,0,0);
SetGameModeText("ZM v0.1");
SetWorldTime(0);
SetNameTagDrawDistance(5);
SetTeamCount(2);
ShowNameTags(0);
ShowPlayerMarkers(1);
UsePlayerPedAnims();
AllowInteriorWeapons(1);
DisableInteriorEnterExits();
Arena[ID] = 0;
SetTimer("AnnounceWinner",360000,1);
return 1;
}
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid,COLOR_YELLOW,"Welcome to Galantes Zombie Mod");
SendClientMessage(playerid,COLOR_YELLOW,"Type /help for some help.");
PlayerCount ++;
return 1;
}
public OnPlayerDisconnect(playerid)
{
PlayerCount --;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(PlayerTeam[playerid] == 0)
{
HumanTeam(playerid);
SetPlayerTeam(playerid,0);
}
else if(PlayerTeam[playerid] == 1)
{
ZombieTeam(playerid);
SetPlayerTeam(playerid,1);
}
switch(Arena[ID])
{
case 0:
{
if(PlayerTeam[playerid] == 0)
{
SetPlayerPos(playerid,1300.0236,-790.1140,1084.0078);
SetPlayerFacingAngle(playerid,0.3154);
SetPlayerInterior(playerid,5);
}
if(PlayerTeam[playerid] == 1)
{
SetPlayerPos(playerid,1266.4395,-780.0988,1091.9063);
SetPlayerFacingAngle(playerid,269.7846);
SetPlayerInterior(playerid,5);
}
}
case 1:
{
if(PlayerTeam[playerid] == 0)
{
SetPlayerPos(playerid,2220.3972,-1151.4685,1025.7969);
SetPlayerFacingAngle(playerid,269.3734);
SetPlayerInterior(playerid,15);
}
if(PlayerTeam[playerid] == 1)
{
SetPlayerPos(playerid,2193.5583,-1141.1141,1029.7969);
SetPlayerFacingAngle(playerid,178.7957);
SetPlayerInterior(playerid,15);
}
}
case 2:
{
if(PlayerTeam[playerid] == 0)
{
SetPlayerPos(playerid,2346.9094,-1172.8066,1031.9766);
SetPlayerFacingAngle(playerid,85.3327);
SetPlayerInterior(playerid,5);
}
if(PlayerTeam[playerid] == 1)
{
SetPlayerPos(playerid,2349.6428,-1181.0731,1027.9766);
SetPlayerFacingAngle(playerid,87.8066);
SetPlayerInterior(playerid,5);
}
}
case 3:
{
if(PlayerTeam[playerid] == 0)
{
SetPlayerPos(playerid,366.8517,215.5397,1008.3828);
SetPlayerFacingAngle(playerid,178.3608);
SetPlayerInterior(playerid,3);
}
if(PlayerTeam[playerid] == 1)
{
SetPlayerPos(playerid,348.3492,162.2359,1025.7891);
SetPlayerFacingAngle(playerid,269.5417);
SetPlayerInterior(playerid,3);
}
}
}
return 1;
}
public OnPlayerDeath(playerid)
{
if(PlayerTeam[playerid] == 0)
{
Arena[ZombiesKills] ++;
}
else if(PlayerTeam[playerid] == 1)
{
Arena[HumansKills] ++;
}
switch(Arena[ZombiesKills])
{
case 5: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 5");
case 10: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 10");
case 15: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 15");
case 20: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 20");
case 25: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 25");
case 30: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 30");
case 35: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 35");
case 40: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 40");
case 45: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 45");
case 50:
{
SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 50");
AnnounceWinner();
}
}
switch(Arena[HumansKills])
{
case 5: SendClientMessageToAll(COLOR_GREEN,"HUMANS TEAM'S SCORE: 5");
case 10: SendClientMessageToAll(COLOR_GREEN,"HUMANS TEAM'S SCORE: 10");
case 15: SendClientMessageToAll(COLOR_GREEN,"HUMANS TEAM'S SCORE: 15");
case 20: SendClientMessageToAll(COLOR_GREEN,"HUMANS TEAM'S SCORE: 20");
case 25: SendClientMessageToAll(COLOR_GREEN,"HUMANS TEAM'S SCORE: 25");
case 30: SendClientMessageToAll(COLOR_GREEN,"HUMANS TEAM'S SCORE: 30");
case 35: SendClientMessageToAll(COLOR_GREEN,"HUMANS TEAM'S SCORE: 35");
case 40: SendClientMessageToAll(COLOR_GREEN,"HUMANS TEAM'S SCORE: 40");
case 45: SendClientMessageToAll(COLOR_GREEN,"HUMANS TEAM'S SCORE: 45");
case 50:
{
SendClientMessageToAll(COLOR_GREEN,"HUMANS TEAM'S SCORE: 50");
AnnounceWinner();
}
}
return 1;
}
public OnPlayerRequestClass(playerid,classid)
{
SetPlayerInterior(playerid,14);
SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
if(classid == 0)
{
PlayerTeam[playerid] = 0;
SetPlayerTeam(playerid,0);
}
else if(classid == 1)
{
PlayerTeam[playerid] = 1;
SetPlayerTeam(playerid,1);
}
return 1;
}
public AnnounceWinner()
{
if(Arena[ZombiesKills] > Arena[HumansKills])
{
GameTextForAll("~r~ZOMBIES~w~ WON~y~ ]]",3000,5);
format(Text,256,"Infected humans: %d | Died zombies: %d",
Arena[ZombiesKills],Arena[HumansKills]);
SendClientMessageToAll(COLOR_YELLOW,Text);
}
if(Arena[ZombiesKills] < Arena[HumansKills])
{
GameTextForAll("~b~HUMANS~w~ WON~y~ ]]",3000,5);
format(Text,256,"Died zombies: %d | Infected humans: %d",
Arena[HumansKills],Arena[ZombiesKills]);
SendClientMessageToAll(COLOR_YELLOW,Text);
}
if(Arena[ZombiesKills] == Arena[HumansKills])
{
GameTextForAll("~y~ DRAW",3000,5);
format(Text,256,"Both teams had %d deaths.",
Arena[ZombiesKills]);
SendClientMessageToAll(COLOR_YELLOW,Text);
}
Arena[ID] ++;
SetTimer("ChangeRound",10000,0);
SendClientMessageToAll(COLOR_RED,"Wait 10 seconds till next round starts!");
for(new i = 0; i < MAX_PLAYERS; i++)
{
SetPlayerCameraPos(i,-1438.0342,1751.5375,45.6543);
SetPlayerCameraLookAt(i,-1736.0754,1132.5067,45.6543);
SetPlayerInterior(i,0);
}
return 1;
}
public ChangeRound()
{
Arena[ZombiesKills] = 0;
Arena[HumansKills] = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
SpawnPlayer(i);
switch(Arena[ID])
{
case 0:
{
SetPlayerInterior(i,5);
}
case 1:
{
SetPlayerInterior(i,15);
}
case 2:
{
SetPlayerInterior(i,5);
}
case 3:
{
SetPlayerInterior(i,3);
Arena[ID] = 0;
}
}
}
return 1;
}
public OnPlayerUpdate(playerid)
{
new Float:NewHP;
GetPlayerArmour(playerid,NewHP);
if(NewHP < OldHP[playerid])
{
new Skin = GetPlayerSkin(playerid);
if(Skin == 285 || Skin == 287 || Skin == 70 || Skin == 33)
{
ZombieTeam(playerid);
Arena[ZombiesKills] ++;
switch(Arena[ZombiesKills])
{
case 5: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 5");
case 10: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 10");
case 15: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 15");
case 20: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 20");
case 25: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 25");
case 30: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 30");
case 35: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 35");
case 40: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 40");
case 45: SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 45");
case 50:
{
SendClientMessageToAll(COLOR_GREEN,"ZOMBIES TEAM'S SCORE: 50");
AnnounceWinner();
}
}
}
}
OldHP[playerid] = NewHP;
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp(cmdtext,"/help",true)==0)
{
SendClientMessage(playerid,COLOR_YELLOW,"This is gamemod is based on Human VS Zombies.");
SendClientMessage(playerid,COLOR_YELLOW,"Zombies should use knife to infect humans.");
SendClientMessage(playerid,COLOR_YELLOW,"Humans should try to kill zombies and stick together");
}
return 1;
}
public OnPlayerRequestClass(playerid,classid)
{
SetPlayerInterior(playerid,14);
SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
if(classid == 0 || classid == 1 || classid == 2 || classid == 3)
{
PlayerTeam[playerid] = 0;
SetPlayerTeam(playerid,0);
}
else if(classid == 4 || classid == 5 || classid == 6 || classid == 7)
{
PlayerTeam[playerid] = 1;
SetPlayerTeam(playerid,1);
}
return 1;
}
Originally Posted by ZzZzZ
ohhh i think i got it thanks!
but how can i add textdraw to skin selection? |
Originally Posted by ZzZzZ
ohhh i think i got it thanks!
but how can i add textdraw to skin selection? |
TextDrawShowForPlayer(playerid,Put Text Draw Name Here);
TextDrawHideForPlayer(playerid,Put Text Draw Name Here);
new string[156];
switch (classid) {
case 0,1,2,3:
{
format(string, sizeof(string), "~b~Human",playerid);
GameTextForPlayer(playerid, string, 2000,6);
} case 4,5,6,7:
{
format(string, sizeof(string), "~r~Zombie",playerid);
GameTextForPlayer(playerid, string, 2000,6);
}
}
return 1;
}