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?
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
I guess, i posted in wrong place so sorry for that :-X I was looking at general discussion forum and i posted it there
@Kusanagi My console is saying that the index b doesn't exist
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
@Kusanagi When i put wanted level on myself then an error occurs!!! Now console is saying: The index "wantedLevel" doesn't exist!!!
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
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
should work just fine
i also modified the code a little
Tested! works