Why isnt this working
#1

Solved
Reply
#2

What do you mean not working? As in ingame not working or you get errors?
Reply
#3

Whats not working on it? Any errors?
Reply
#4

I don't see you define closest to a player or a loop. Did you forget it or just not show it?


And i recommend you to check if the closest is already a zombie or you could just infect the same person over and over.
Reply
#5

Who is it?
pawn Код:
if(IsPlayerInRangeOfPoint(closest,1,x,y,z))
Who is it closest? and you also need to check to not be your self as closest player.
Reply
#6

closest is nothing
Reply
#7

This just wasn't finished all the way....

Should be something like this

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_FIRE))
    {
        new closest = GetClosestPlayer(something);
        if(gTeam[playerid] == TEAM_ZOMBIE)
        {
            if(gTeam[closest] == TEAM_ZOMBIE) return SendClientMessage(playerid,red,"You cannot infect zombies");
            new Float:x,Float:y,Float:z;
            GetPlayerPos(playerid,x,y,z);
            if(IsPlayerInRangeOfPoint(closest,1,x,y,z))
            {
                SetPlayerSkin(closest,162);
                gTeam[closest] = 1;//w
                GameTextForPlayer(closest, "~r~infected!", 5000,5);
                TogglePlayerControllable(closest,1);
                Zombie(closest);
            }
        }
    }
    return 1;
}
Reply
#8

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
This just wasn't finished all the way....

Should be something like this

pawn Код:
if(closest == TEAM_ZOMBIE) return SendClientMessage(playerid,red,"You cannot infect zombies");
that won't work it'd be gTeam[closest]
Reply
#9

Thanks, fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)