What happend here?! -
Thanks - 29.12.2017
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 first, second, third, fourth, fifth;
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(first, Nick[0], MAX_PLAYER_NAME);
format(string20, sizeof(string20), "~R~#1 - ~W~%s", Nick[0]);
TextDrawSetString(Textdraw12, string20);
TextDrawShowForPlayer(playerid, Textdraw12);
}
}
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(second, Nick[0], MAX_PLAYER_NAME);
format(string, sizeof(string), "~R~#2 - ~W~%s", Nick[0]);
second = d;
TextDrawSetString(Textdraw13, string);
TextDrawShowForPlayer(playerid, Textdraw13);
}
}
for(new s=0;s<MAX_PLAYERS;s++) // This loop will check for the player that has the third most kills
{
if(first == s || second == s) continue;
if(kills[s] > kills[third])
{
GetPlayerName(third, Nick[0], MAX_PLAYER_NAME);
format(string[0], sizeof(string), "~R~#3 - ~W~%s", Nick[0]);
third = s;
TextDrawSetString(Textdraw14, string);
TextDrawShowForPlayer(playerid, Textdraw14);
}
}
for(new a=0;a<MAX_PLAYERS;a++) // This loop will check for the player that has the fourth most kills
{
if(first == a || second == a || third == a) continue;
if(kills[a] > kills[fourth])
{
GetPlayerName(fourth, Nick[0], MAX_PLAYER_NAME);
format(string, sizeof(string), "~R~#4 - ~W~%s", Nick[0]);
fourth = a;
TextDrawSetString(Textdraw15, string);
TextDrawShowForPlayer(playerid, Textdraw15);
}
}
for(new c=0;c<MAX_PLAYERS;c++) // This loop will check for the player that has the fifth most kills
{
if(first == c || second == c || third == c || fourth == c) continue;
if(kills[c] > kills[fifth])
{
GetPlayerName(fifth, Nick[0], MAX_PLAYER_NAME);
format(string, sizeof(string), "~R~#5 - ~W~%s", Nick[0]);
fifth = c;
TextDrawSetString(Textdraw15, string);
TextDrawShowForPlayer(playerid, Textdraw16);
}
}
return 1;
}
I've creating the Textdraws for them and There are no problem Just They not updated Kills when someone Killed
Re: What happend here?! -
Kaperstone - 29.12.2017
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.
Re: What happend here?! -
Thanks - 29.12.2017
No, There are no wrong with textdraws connect, But The problem With update Textdraws, BTW! Why creating a timer OnPlayerDeath?
Re: What happend here?! -
Thanks - 29.12.2017
Anyway, I've creating a timer... Like that
OnPlayerDeath: SetTimerEx("TextdrawHide", 5000, false, "Hide", playerid);
PHP код:
forward TextdrawHide(playerid);
public TextdrawHide(playerid)
{
TextDrawHideForPlayer(playerid, Textdraw12);
TextDrawHideForPlayer(playerid, Textdraw13);
TextDrawHideForPlayer(playerid, Textdraw14);
TextDrawHideForPlayer(playerid, Textdraw15);
TextDrawHideForPlayer(playerid, Textdraw16);
return 1;
}
So...
Re: What happend here?! -
RogueDrifter - 29.12.2017
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(first, Nick[0], MAX_PLAYER_NAME);
format(string20, sizeof(string20), "~R~#1 - ~W~%s", Nick[0]);
TextDrawSetString(Textdraw12, string20);
TextDrawShowForPlayer(playerid, Textdraw12);
}
}
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.
Re: What happend here?! -
Thanks - 29.12.2017
OnPlayerSpawn
PHP код:
public OnPlayerSpawn(playerid)
{
new Random = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
SetPlayerColor(playerid, COLOR_RED);
GivePlayerWeapon(playerid, 27, 100);
GivePlayerWeapon(playerid, 24, 100);
GivePlayerWeapon(playerid, 28, 5000);
GivePlayerWeapon(playerid, 31, 100);
GivePlayerWeapon(playerid, 34, 100);
new first, second, third, fourth, fifth;
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(first, Nick[0], MAX_PLAYER_NAME);
format(string, sizeof(string), "~R~#1 - ~W~%s", Nick[0]);
TextDrawSetString(Textdraw12, string);
TextDrawShowForPlayer(playerid, Textdraw12);
}
}
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(second, Nick[0], MAX_PLAYER_NAME);
format(string, sizeof(string), "~R~#2 - ~W~%s", Nick[0]);
second = d;
TextDrawSetString(Textdraw13, string);
TextDrawShowForPlayer(playerid, Textdraw13);
}
}
for(new s=0;s<MAX_PLAYERS;s++) // This loop will check for the player that has the third most kills
{
if(first == s || second == s) continue;
if(kills[s] > kills[third])
{
GetPlayerName(third, Nick[0], MAX_PLAYER_NAME);
format(string[0], sizeof(string), "~R~#3 - ~W~%s", Nick[0]);
third = s;
TextDrawSetString(Textdraw14, string);
TextDrawShowForPlayer(playerid, Textdraw14);
}
}
for(new a=0;a<MAX_PLAYERS;a++) // This loop will check for the player that has the fourth most kills
{
if(first == a || second == a || third == a) continue;
if(kills[a] > kills[fourth])
{
GetPlayerName(fourth, Nick[0], MAX_PLAYER_NAME);
format(string, sizeof(string), "~R~#4 - ~W~%s", Nick[0]);
fourth = a;
TextDrawSetString(Textdraw15, string);
TextDrawShowForPlayer(playerid, Textdraw15);
}
}
for(new c=0;c<MAX_PLAYERS;c++) // This loop will check for the player that has the fifth most kills
{
if(first == c || second == c || third == c || fourth == c) continue;
if(kills[c] > kills[fifth])
{
GetPlayerName(fifth, Nick[0], MAX_PLAYER_NAME);
format(string, sizeof(string), "~R~#5 - ~W~%s", Nick[0]);
fifth = c;
TextDrawSetString(Textdraw15, string);
TextDrawShowForPlayer(playerid, Textdraw16);
}
}
return 1;
}
Is there wrong?
Re: What happend here?! -
Thanks - 29.12.2017
Help?
Re: What happend here?! -
Thanks - 30.12.2017
heeeeeeeeeeeeeeeeelp
Re: What happend here?! -
Thanks - 31.12.2017
GUYS HELP!
Re: What happend here?! -
RogueDrifter - 31.12.2017
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.