SA-MP Forums Archive
Why isnt this working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why isnt this working (/showthread.php?tid=178420)



Why isnt this working - Kitten - 22.09.2010

Solved


Re: Why isnt this working - Retardedwolf - 22.09.2010

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


Re: Why isnt this working - willsuckformoney - 22.09.2010

Whats not working on it? Any errors?


Re: Why isnt this working - Desert - 22.09.2010

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.


Re: Why isnt this working - Voldemort - 22.09.2010

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.


Re: Why isnt this working - cessil - 22.09.2010

closest is nothing


Re: Why isnt this working - willsuckformoney - 22.09.2010

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;
}



Re: Why isnt this working - cessil - 22.09.2010

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]


Re: Why isnt this working - willsuckformoney - 22.09.2010

Thanks, fixed.