Playermarks visible after 5 kills
#1

Hello everyone,
For my new gamemode I was trying to make a system that if you make 5 kills you get to see the player marks until you go dead.. I had worked out a script with a timer where if you got 5 for your score (each time you kill, score goes +1) you score gets reset and you can see all the player marks. But that doesn't work.. Even the score reset fails. So does anyone got any tips or so to make this feature?
Reply
#2

At The top of your script:
pawn Код:
new Kills[MAX_PLAYERS];
OnGameModeInit:
pawn Код:
SetTimer("CheckKills",100,1);
Anywhere:
pawn Код:
public CheckKills(playerid)
{
  if(Kills[playerid] == 5)
  {
    Kills[playerid] = 0;
        for(new i = 0; i <= MAX_PLAYERS; i++)
    {
        SetPlayerMarkerForPlayer(playerid,i,0xFF0000FF);//This sets all other player markers FOR THAT PLAYER to red. Not sure how to jsut show them.
    }
  }
}
OnPlayerDeath
pawn Код:
Kills[killerid] += 1;
(Untested, But looks like it should work.)
Reply
#3

Quote:
Originally Posted by Miokie*
At The top of your script:
pawn Код:
new Kills[MAX_PLAYERS];
OnGameModeInit:
pawn Код:
SetTimer("CheckKills",100,1);
Anywhere:
pawn Код:
public CheckKills(playerid)
{
  if(Kills[playerid] == 5)
  {
    Kills[playerid] = 0;
        for(new i = 0; i <= MAX_PLAYERS; i++)
    {
        SetPlayerMarkerForPlayer(playerid,i,0xFF0000FF);//This sets all other player markers FOR THAT PLAYER to red. Not sure how to jsut show them.
    }
  }
}
OnPlayerDeath
pawn Код:
Kills[killerid] += 1;
(Untested, But looks like it should work.)
Why you using Kills[killerid] +=1; ? Why not Kills[killerid] ++;?
Reply
#4

Quote:
Originally Posted by Luka[balkan-samp.com
]
Quote:
Originally Posted by Miokie*
At The top of your script:
pawn Код:
new Kills[MAX_PLAYERS];
OnGameModeInit:
pawn Код:
SetTimer("CheckKills",100,1);
Anywhere:
pawn Код:
public CheckKills(playerid)
{
  if(Kills[playerid] == 5)
  {
    Kills[playerid] = 0;
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
        SetPlayerMarkerForPlayer(playerid,i,0xFF0000FF);//This sets all other player markers FOR THAT PLAYER to red. Not sure how to jsut show them.
    }
  }
}
OnPlayerDeath
pawn Код:
Kills[killerid] += 1;
(Untested, But looks like it should work.)
Why you using Kills[killerid] +=1; ? Why not Kills[killerid] ++;?
Ah its the way i write things sometimes i forget about ++;
Reply
#5

Thanks mate! I just tested it and the color of the name changes but I still don't see anything on the radar. Has it something to do with the fact that I got ShowPlayerMarkers(0); in my script? Does it overrule SetPlayerMarkerForPlayer?
Reply
#6

while i was working on a possible solution, i see that a possible solution has already been given, while i thought differently of what you want compared to what Miokie thought what you want.

Anyways, i'll post what i did:

What i thought you said was when a player dies hsi score gets set to "0". i.e. the score you see when you press the TAB button. A person who kills someone gets +1 score and if his score is 5 or more, his marker will show to other players. When he dies, score gets set to 0 and marker is hidden.

Untested

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  SendDeathMessage(killerid, playerid, reason);
  SetPlayerScore(killerid,(GetPlayerScore(killerid))+1); //killer gets +1 score
  SetPlayerScore(playerid,0); // player who dies get 0 score
    UpdateMyMarkerToAll(playerid, killerid);
  return 1;
}

UpdateMyMarkerToAll(playerid, killerid)
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerScore(playerid) == 0) return SetPlayerMarkerForPlayer( i, playerid, ( GetPlayerColor( killerid ) & 0xFFFFFF00 ) );
            if(GetPlayerScore(killerid) >= 5)
            {
                SetPlayerMarkerForPlayer( i,killerid,0xFF0000FF );
                SendClientMessage(playerid,0x99FF00AA,"Your marker is now showing");
            }
            else
            {
                SetPlayerMarkerForPlayer( i, killerid, ( GetPlayerColor( killerid ) & 0xFFFFFF00 ) );
                SendClientMessage(playerid,0x99FF00AA,"Your marker is now hidden");
            }
        }
    }
}

edit: looks like it works miokies did the job from what ArnoVL says
Reply
#7

Thanks for your efforts [B2K]Hustler, but that was indeed not what I was looking for.. But Miokie's script does not work entirely..
Quote:
Originally Posted by ArnoVL
Thanks mate! I just tested it and the color of the name changes but I still don't see anything on the radar. Has it something to do with the fact that I got ShowPlayerMarkers(0); in my script? Does it overrule SetPlayerMarkerForPlayer?
Reply
#8

pawn Код:
//Top
new Kills[MAX_PLAYERS];

//OnPlayerDeath
if((reason != 255) || (killerid != 255))
{
   Kills[killerid]++;
   if(Kills[killerid] == 5)
   {
      Kills[killerid] = 0;
      for(new i; i<MAX_PLAYERS; i++)
      {
         SetPlayerMarkerForPlayer(killerid,i,0xFF0000FF);
      }
   }
}
You can try this. Although, it may do the same thing that Miokie's did. Although more efficiently.
Reply
#9

Quote:
Originally Posted by Backwardsman97
pawn Код:
//Top
new Kills[MAX_PLAYERS];

//OnPlayerDeath
if((reason != 255) || (killerid != 255))
{
  Kills[killerid]++;
  if(Kills[killerid] == 5)
  {
     Kills[killerid] = 0;
     for(new i; i<MAX_PLAYERS; i++)
     {
        SetPlayerMarkerForPlayer(killerid,i,0xFF0000FF);
     }
  }
}
You can try this. Although, it may do the same thing that Miokie's did. Although more efficiently.
it doesn't matter if it fails, if it fails efficiently!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)