SA-MP Forums Archive
Picking 1 person - 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: Picking 1 person (/showthread.php?tid=190330)



Picking 1 person - Kitten - 14.11.2010

Solved


Re: Picking 1 person - willsuckformoney - 14.11.2010

That would have to be
pawn Код:
new Infected = random(1);
Also if I get this right you can just

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    if(IsPlayerInRangeOfPoint(i,5,X,Y,Z))
    {
        //Your stuff
    }
}
That was just because I'm not sure what exactly you mean.


Re: Picking 1 person - Kitten - 14.11.2010

Solved


Re: Picking 1 person - Cameltoe - 14.11.2010

Do you want the infected player to be random?

pawn Код:
stock GetRandomPlayer() // No idea who wrote it..
{
  new yplayer[MAX_PLAYERS+1];
  for (new y = 0; y != MAX_PLAYERS; y ++) {
    if (IsPlayerConnected(y)) {
      yplayer[0] ++;
      yplayer[yplayer[0]] = y;
    }
  }
  return yplayer[random(yplayer[0])+1];
}



Re: Picking 1 person - Kitten - 14.11.2010

Solved


Re: Picking 1 person - The_Moddler - 14.11.2010

pawn Код:
stock GetRandomID()
{
    new rand, count = 0;
    do
    {
        rand = random(MAX_PLAYERS);
        count++;
    }
    while(!IsPlayerConnected(rand) && count < MAX_PLAYERS);
    if(count >= MAX_PLAYERS) return INVALID_PLAYER_ID;
    else
    return rand;
}
Just made it quickly, should work.

Use this:

pawn Код:
public Infected(playerid = GetRandomID())
{
    ResetPlayerWeapons(playerid);
    SetPlayerColor(playerid,Z_COLOR);
    SetPlayerTeam(playerid,TEAM_ZOMBIE);
    SetPlayerHealth(playerid,50);
    SetPlayerWeather(playerid,32);
    SetPlayerTime(playerid,24,0);
    new name[MAX_PLAYER_NAME], string4[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(string4, sizeof(string4), "Player %s has just been infected turned into [Zombie]",name);
    SendClientMessageToAll(COLOR_RED,string4);
    GameTextForPlayer(playerid,"~r~ YOU JUST BEEN ZOMBIFIED INTO INFECTED SIDE",6000,4);

    new skin = random(4);
    switch(skin)
    {
        case 0:SetPlayerSkin(playerid,Z_SKIN2);
        case 1:SetPlayerSkin(playerid,Z_SKIN);
        case 2:SetPlayerSkin(playerid,137);
    }
   
    return 1;
}



Re: Picking 1 person - Kitten - 14.11.2010

Solved


Re: Picking 1 person - The_Moddler - 14.11.2010

Yes. (8chars¬¬)


Re: Picking 1 person - Kitten - 14.11.2010

Solved


Re: Picking 1 person - Kitten - 14.11.2010

Solved