Wanted Level help?

Started by Goku, Mar 21, 2016, 03:29 AM

Previous topic - Next topic

Goku

Guys, i need another help? I checked wiki too but i didn't understand much with that example!!! And please don't give me complete code!!! Like if a player kills another player then i put that line into the function onplayerkill player.SetWantedLevel = 1;
Then how am i suppose to create a command that will find all wanted players in the server?
There is only one thing that i know about life - Some mistakes happen by chance, but some mistakes happen because we make 'em happen.

MacTavish

#1
onPlayerKill(killer, player, reason, bodypart)
{
killer.WantedLevel+=1;
}

else if (  cmd == "wantedlist" )
{
local plr, w, max =GetMaxPlayers();
for( local i = 0; i <= max; ++i)
{
    plr = FindPlayer( i );
if ( ( plr ) && ( plr.WantedLevel >= 1 ) )
    {
if ( w ) w= w+ ", "("+plr.WantedLevel+")"" + plr.Name + ""
else w= "("+plr.WantedLevel+")"+ plr.Name + ""
    }
}
if ( w ) MessagePlayer("Wanted List: ( " + w + " )",player );
else MessagePlayer("No Wanted Players Found.",player );
}

Updated

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Goku

I guess, i posted in wrong place so sorry for that :-X I was looking at general discussion forum and i posted it there
There is only one thing that i know about life - Some mistakes happen by chance, but some mistakes happen because we make 'em happen.

Goku

@Kusanagi My console is saying that the index b doesn't exist
There is only one thing that i know about life - Some mistakes happen by chance, but some mistakes happen because we make 'em happen.

MacTavish

Quote from: Dangerous on Mar 21, 2016, 04:45 AM@Kusanagi My console is saying that the index b doesn't exist

Sorry missed something while editing the code now updated

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Goku

@Kusanagi When i put wanted level on myself then an error occurs!!! Now console is saying: The index "wantedLevel" doesn't exist!!!
There is only one thing that i know about life - Some mistakes happen by chance, but some mistakes happen because we make 'em happen.

Mötley

#6
function onPlayerKill( killer, killed, weapon, bodypart )
{
killed.WantedLevel -= 1;
killer.WantedLevel += 1;

return 1;
}

else if ( cmd == "wanted" )
{
          local count = 0;
   
          for (local i=0;i<GetMaxPlayers();i++)
          {
            local target = FindPlayer(i);
     
            if (target)
            {
              if ((target.WantedLevel >= 1) && (target.WantedLevel <= 6))
              {
                MessagePlayer("[#ffffff]"+target.Name+" (" + target.ID  + ")", player );
                count++;
              }
            }
          }
   
          if (count == 0)
          {
            WANTEDNOPLAYERS(pPlayer);
          }
           
return true;
    }

function WANTEDNOPLAYERS(player)
{
  MessagePlayer( "[#ff0000]No players.", player );
}

Play with this.

It is possible I am wrong somewhere in cmd but should be correct!!!
This was copied from a LU server of mine due to my version in VC would never work for you. This should help you

Goku

Did u really think this command will work??? I dont think so coz it is LU server command!!! Maybe it should work!!! I will try
There is only one thing that i know about life - Some mistakes happen by chance, but some mistakes happen because we make 'em happen.

Mötley

#8
should work just fine
i also modified the code a little

Tested! works