bugged blueberry & senddeathmessage
#8

There it is your problem, in the timer, you should check if the player is still alive or not before using SetPlayerZombie. Because you should not use SetPlayerSkin when the player just died, otherwise you will get "spawn-glitch", having the "smoking" animation, spawning in the center of san andreas (0.0, 0.0, 0.0) where you fall down out of the map and getting teleported back on the ground near blueberry.
Код:
stock SetPlayerZombie(playerid)
{
	new playerstate = GetPlayerState(playerid);
	if(playerstate >=  PLAYER_STATE_ONFOOT && playerstate <= PLAYER_STATE_ENTER_VEHICLE_PASSENGER)
	{
		SetPlayerColor(playerid,ZOMBIE_COLOR);
		SetPlayerTeam(playerid,ZOMBIE);
		team[playerid] = ZOMBIE;
		SetPlayerHealth(playerid, 100.0);
		switch(random(4))
		{
        	case 0: SetPlayerSkin(playerid,162);
        	case 1: SetPlayerSkin(playerid,135);
       		case 2: SetPlayerSkin(playerid,137);
        	case 3: SetPlayerSkin(playerid,196);
		}
		ResetPlayerWeapons(playerid);
		ClearAnimations(playerid);
		return 1; // player sucessfully becomes a zombie
	}
	return 0; // player was failed to be a zombie
}
Now the problem is, you wont be turned into zombie if the code was called when you just death or in spectate screen. You have to do that if-else statement like above.

So assuming that you want to turn the "human" into a "zombie", with having this OnPlayerDeath:
Код:
if(team[playerid] == HUMAN) team[playerid] = ZOMBIE;
Then you can just add it like this OnPlayerSpawn:
Код:
public OnPlayerSpawn(playerid)
{
	if(MapInfo[Durasi] <= MapInfo[Deadtime])
	{
		SetPlayerZombie(playerid);
	}
	else 
	{
		if(team[playerid] == HUMAN) SetPlayerHuman(playerid);
		else SetPlayerZombie(playerid);
	}
	return 1;
}
Something like that, hope you understand, just test it and it's up to you how you want the logic be, otherwise it will be still buggy at some cases, e.g. it's the time to change random humans to zombies but the player was dead/not spawned, they might be still a human.

Or just use the return code of SetPlayerZombie on here:
Код:
Timer:ServerUpdate[1250]() // frrm y less
{
	if(GameOver == false)
	{
		MapInfo[Durasi]--;
		if(MapInfo[Durasi] == MapInfo[Deadtime])
		{
			new str[254];
			do
			{
				new randomid = Iter_Random(Player);
			}
			while(team[randomid] == ZOMBIE || SetPlayerZombie(randomid) == 0); // This will keep picking another player id when the one picked was failed to be a zombie (player was already a zombie or was not alive).

			format(str,sizeof(str),"{FFFF00}[INFECTION]: {FFFFFF}%s has become a zombie.",GetName(randomid));
			SendClientMessageToAll(-1,str);
			GameTextForAll("~r~zombies~w~ come, ~g~save~w~ yourself from a zombie ~r~attack~r~", 4000, 4);
			printf("%s selected to be a zombie!", GetName(randomid));
		}
	}
	return 1;
}
Note that if you use the code like this, it means the player who just died wont be able to be a zombie when the timer gets called. It will still make them into a zombie if they died normally from a zombie infection since we have the code in OnPlayerDeath & OnPlayerSpawn. But that's up to you how you want the logic.


EDIT: nvm, see the code changes above.
Sorry for my bad english.
Reply


Messages In This Thread
bugged blueberry & senddeathmessage - by kloning1 - 23.12.2016, 10:49
Re: bugged blueberry & senddeathmessage - by oMa37 - 23.12.2016, 10:51
Re: bugged blueberry & senddeathmessage - by kloning1 - 23.12.2016, 11:11
Re: bugged blueberry & senddeathmessage - by oMa37 - 23.12.2016, 11:25
Re: bugged blueberry & senddeathmessage - by kloning1 - 23.12.2016, 12:36
Re: bugged blueberry & senddeathmessage - by RoboN1X - 23.12.2016, 12:39
Re: bugged blueberry & senddeathmessage - by kloning1 - 23.12.2016, 12:51
Re: bugged blueberry & senddeathmessage - by RoboN1X - 23.12.2016, 13:11
Re: bugged blueberry & senddeathmessage - by kloning1 - 24.12.2016, 03:54
Re: bugged blueberry & senddeathmessage - by kloning1 - 25.12.2016, 00:30

Forum Jump:


Users browsing this thread: 2 Guest(s)