An Infecting problem
#1

Hey,well i want to make that zombie can infect other people,but it wont work,its like if someone takes some Healths away from you,you will be zombie,heres the Code,oh btw,if u got more time,can someone make me code if u die u will be zombie,thanks



pawn Код:
public OnPlayerUpdate(playerid)
{
        new Float:NewArmor;
    new Float:NewHP;
    GetPlayerHealth(playerid,NewHP);
    GetPlayerArmour(playerid,NewArmor);
    if(NewHP < OldHP[playerid])
    {
    if(NewArmor < OldArmor[playerid])
    {
        new Skin = GetPlayerSkin(playerid);
        if(Skin == 280 || Skin == 104 || Skin == 12 || Skin == 277)
        {
                format(string, sizeof(string), "~r~Infected",playerid);
                GameTextForPlayer(playerid, string, 2000,5);
            ZombieTeam(playerid);
            SetPlayerSkin(playerid,137);
            }
        }
        }
    OldHP[playerid] = NewHP;
    OldArmor[playerid] = NewArmor;
    return 1;
}
Reply
#2

BUMPZ! please,need it very
Reply
#3

Quote:
Originally Posted by ZzZzZ
if u got more time,can someone make me code if u die u will be zombie,thanks
Thats easy.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(NonZombieTeam)
    {
        SetZombieTeamHere
    }
    return 1;
}
Example:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(gTeam[playerid] == TEAM_CIVILIANS)
    {
        gTeam[playerid] = TEAM_ZOMBIES;
    }
    return 1;
}
Reply
#4

oh thanks dude:P
Reply
#5

No Problem.
You might want to make it so it checks if the killer was a zombie:

Another Example:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(gTeam[playerid] == TEAM_CIVILIANS && gTeam[killerid] == TEAM_ZOMBIES)
    {
        gTeam[playerid] = TEAM_ZOMBIES;
    }
    return 1;
}
Reply
#6

wtf,the team still stays human if i make this -.-
Reply
#7

Quote:
Originally Posted by ZzZzZ
wtf,the team still stays human if i make this -.-
That changes the team to Zombie, You might want to change the color/skin etc.. to match the Team.
Reply
#8

i did,but it saves guns..
or gives new ones:S
anyway this is that :

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	if(gTeam[playerid] == TEAM_HUMAN)
	{
		GameTextForPlayer(playerid,"~r~Infected",2000,5);
		SetPlayerSkin(playerid,137);
 		gTeam[playerid] = TEAM_ZOMBIE;
    SetPlayerTeam(playerid,2);
    SetPlayerColor(playerid,TEAM_ZOMBIE_COLOR);
    ResetPlayerWeapons(playerid);
    SetPlayerArmour(playerid,0);
    SetPlayerHealth(playerid,200);
    GivePlayerWeapon(playerid,WEAPON1_ZOMBIE,9999);
	}
	return 1;
}
Reply
#9

what do you mean saves guns?
you sure your not giving those guns in OnPlayerSpawn?
Reply
#10

i dont think so :S

heres the onplayerspawn
Код:
public OnPlayerSpawn(playerid)
{
	SetPlayerInterior(playerid,0);

	if(gTeam[playerid] == TEAM_HUMAN) {
 	SetPlayerHealth(playerid,50.0);
  GameTextForPlayer(playerid,"~w~Stay With other Survivors!",6000,5);
	SendClientMessage(playerid,0xFF000096,"if you need help /help");
	SendClientMessage(playerid,0xFF000096,"NB: Zombies have 200 Health");
  TextDrawHideForPlayer(playerid,Textdraw);
  TextDrawHideForPlayer(playerid,Textdraw);
  TextDrawHideForPlayer(playerid,Textdraw2);
  TextDrawHideForPlayer(playerid,Textdraw2);
  TogglePlayerClock(playerid, 1);
	}
	else if(gTeam[playerid] == TEAM_ZOMBIE) {
  GameTextForPlayer(playerid,"~w~Kill All The ~g~ Survivors",6000,5);
  	SendClientMessage(playerid,0xFF000096,"Type /commands");
  TextDrawHideForPlayer(playerid,Textdraw);
  TextDrawHideForPlayer(playerid,Textdraw);
  TextDrawHideForPlayer(playerid,Textdraw2);
  TextDrawHideForPlayer(playerid,Textdraw2);
  TogglePlayerClock(playerid, 1);
  new iRandom = random(sizeof(RandomSpawn));
  SetPlayerPos(playerid, RandomSpawn[iRandom][0], RandomSpawn[iRandom][1],RandomSpawn[iRandom][2]);
  SetPlayerFacingAngle(playerid, RandomSpawn[iRandom][3]);
  SetPlayerInterior(playerid, 0);
  SetPlayerVirtualWorld(playerid, 0);
}

	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)