What happend here?!
#1

Hello, I've creating a something for Hightlist kills of map And creating the codes But There is a problem What is it?

I've creating the code and there are no errors/warrings but When someone killed other They are not update the Textdraw To Example: Thanks - 1 Like that But I really dont know Its not Updated them Anyone can help me?

PHP код:
public OnPlayerSpawn(playerid)
{
      new 
firstsecondthirdfourthfifth;
    new 
Nick[50][MAX_PLAYER_NAME], string[MAX_PLAYER_NAME],string20[MAX_PLAYER_NAME];
    for(new 
i=0;i<MAX_PLAYERS;i++) // This loop will check for the player that has the most kills
    
{
        if(
kills[i] > kills[first])
        {
            
first i;
            
GetPlayerName(firstNick[0], MAX_PLAYER_NAME);
            
format(string20sizeof(string20), "~R~#1 - ~W~%s"Nick[0]);
            
TextDrawSetString(Textdraw12string20);
            
TextDrawShowForPlayer(playeridTextdraw12);
        }
    }
    for(new 
d=0;d<MAX_PLAYERS;d++) // This loop will check for the player that has the second most kills
    
{
        if(
first == d) continue;
        if(
kills[d] > kills[second])
        {
            
GetPlayerName(secondNick[0], MAX_PLAYER_NAME);
            
format(stringsizeof(string), "~R~#2 - ~W~%s"Nick[0]);
            
second d;
            
TextDrawSetString(Textdraw13string);
            
TextDrawShowForPlayer(playeridTextdraw13);
        }
    }
    for(new 
s=0;s<MAX_PLAYERS;s++) // This loop will check for the player that has the third most kills
    
{
        if(
first == || second == s) continue;
        if(
kills[s] > kills[third])
        {
            
GetPlayerName(thirdNick[0], MAX_PLAYER_NAME);
            
format(string[0], sizeof(string), "~R~#3 - ~W~%s"Nick[0]);
            
third s;
            
TextDrawSetString(Textdraw14string);
            
TextDrawShowForPlayer(playeridTextdraw14);
        }
    }
    for(new 
a=0;a<MAX_PLAYERS;a++) // This loop will check for the player that has the fourth most kills
    
{
        if(
first == || second == || third == a) continue;
        if(
kills[a] > kills[fourth])
        {
            
GetPlayerName(fourthNick[0], MAX_PLAYER_NAME);
            
format(stringsizeof(string), "~R~#4 - ~W~%s"Nick[0]);
            
fourth a;
            
TextDrawSetString(Textdraw15string);
            
TextDrawShowForPlayer(playeridTextdraw15);
        }
    }
    for(new 
c=0;c<MAX_PLAYERS;c++) // This loop will check for the player that has the fifth most kills
    
{
        if(
first == || second == || third == || fourth == c) continue;
        if(
kills[c] > kills[fifth])
        {
            
GetPlayerName(fifthNick[0], MAX_PLAYER_NAME);
            
format(stringsizeof(string), "~R~#5 - ~W~%s"Nick[0]);
            
fifth c;
            
TextDrawSetString(Textdraw15string);
            
TextDrawShowForPlayer(playeridTextdraw16);
        }
    }
    return 
1;

I've creating the Textdraws for them and There are no problem Just They not updated Kills when someone Killed
Reply
#2

While they're playing? or the textdraw that you show when a player connects is wrong?
If the first one then you need to update the textdraw, do it from OnPlayerDeath or with a timer.

If the second one, then the way you store the kills in variables is wrong.
Reply
#3

No, There are no wrong with textdraws connect, But The problem With update Textdraws, BTW! Why creating a timer OnPlayerDeath?
Reply
#4

Anyway, I've creating a timer... Like that

OnPlayerDeath: SetTimerEx("TextdrawHide", 5000, false, "Hide", playerid);

PHP код:
forward TextdrawHide(playerid);
public 
TextdrawHide(playerid)
{
    
TextDrawHideForPlayer(playeridTextdraw12);
    
TextDrawHideForPlayer(playeridTextdraw13);
    
TextDrawHideForPlayer(playeridTextdraw14);
    
TextDrawHideForPlayer(playeridTextdraw15);
    
TextDrawHideForPlayer(playeridTextdraw16);
    return 
1;

So...
Reply
#5

Wait... shouldn't the variables be on top and then you do something within the lines of this..?
PHP код:
for(new i=0;i<MAX_PLAYERS;i++) // This loop will check for the player that has the most kills 
    

        if(
kills[playerid] > kills[i]) 
        { 
            
first playerid
            
GetPlayerName(firstNick[0], MAX_PLAYER_NAME); 
            
format(string20sizeof(string20), "~R~#1 - ~W~%s"Nick[0]); 
            
TextDrawSetString(Textdraw12string20); 
            
TextDrawShowForPlayer(playeridTextdraw12); 
        } 
    } 
This is the way to do it if you're putting it at OnPlayerSpawn, you gotta put playerid to use otherwise its absolutely useless putting all of those loops at OnPlayerSpawn or maybe i got the concept wrong but from the code you've shown so far this is what i understood.
Reply
#6

OnPlayerSpawn

PHP код:
public OnPlayerSpawn(playerid)
{
    new 
Random random(sizeof(RandomSpawns));
    
SetPlayerPos(playeridRandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    
SetPlayerFacingAngle(playeridRandomSpawns[Random][3]);
    
    
SetPlayerColor(playeridCOLOR_RED);
    
    
GivePlayerWeapon(playerid27100);
    
GivePlayerWeapon(playerid24100);
    
GivePlayerWeapon(playerid285000);
    
GivePlayerWeapon(playerid31100);
    
GivePlayerWeapon(playerid34100);
    new 
firstsecondthirdfourthfifth;
    new 
Nick[6][MAX_PLAYER_NAME], string[MAX_PLAYER_NAME];
    for(new 
i=0;i<MAX_PLAYERS;i++) // This loop will check for the player that has the most kills
    
{
        if(
kills[i] > kills[first])
        {
            
first i;
            
GetPlayerName(firstNick[0], MAX_PLAYER_NAME);
            
format(stringsizeof(string), "~R~#1 - ~W~%s"Nick[0]);
            
TextDrawSetString(Textdraw12string);
            
TextDrawShowForPlayer(playeridTextdraw12);
        }
    }
    for(new 
d=0;d<MAX_PLAYERS;d++) // This loop will check for the player that has the second most kills
    
{
        if(
first == d) continue;
        if(
kills[d] > kills[second])
        {
            
GetPlayerName(secondNick[0], MAX_PLAYER_NAME);
            
format(stringsizeof(string), "~R~#2 - ~W~%s"Nick[0]);
            
second d;
            
TextDrawSetString(Textdraw13string);
            
TextDrawShowForPlayer(playeridTextdraw13);
        }
    }
    for(new 
s=0;s<MAX_PLAYERS;s++) // This loop will check for the player that has the third most kills
    
{
        if(
first == || second == s) continue;
        if(
kills[s] > kills[third])
        {
            
GetPlayerName(thirdNick[0], MAX_PLAYER_NAME);
            
format(string[0], sizeof(string), "~R~#3 - ~W~%s"Nick[0]);
            
third s;
            
TextDrawSetString(Textdraw14string);
            
TextDrawShowForPlayer(playeridTextdraw14);
        }
    }
    for(new 
a=0;a<MAX_PLAYERS;a++) // This loop will check for the player that has the fourth most kills
    
{
        if(
first == || second == || third == a) continue;
        if(
kills[a] > kills[fourth])
        {
            
GetPlayerName(fourthNick[0], MAX_PLAYER_NAME);
            
format(stringsizeof(string), "~R~#4 - ~W~%s"Nick[0]);
            
fourth a;
            
TextDrawSetString(Textdraw15string);
            
TextDrawShowForPlayer(playeridTextdraw15);
        }
    }
    for(new 
c=0;c<MAX_PLAYERS;c++) // This loop will check for the player that has the fifth most kills
    
{
        if(
first == || second == || third == || fourth == c) continue;
        if(
kills[c] > kills[fifth])
        {
            
GetPlayerName(fifthNick[0], MAX_PLAYER_NAME);
            
format(stringsizeof(string), "~R~#5 - ~W~%s"Nick[0]);
            
fifth c;
            
TextDrawSetString(Textdraw15string);
            
TextDrawShowForPlayer(playeridTextdraw16);
        }
    }
    return 
1;

Is there wrong?
Reply
#7

Help?
Reply
#8

heeeeeeeeeeeeeeeeelp
Reply
#9

GUYS HELP!
Reply
#10

Dude i really can't comprehend your concept here and to me (by what i understood) you need a whole new code re-written... so i'm just gonna forward you to this Killing spree filterscript that's all i got to say now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)