29.12.2017, 17:34
OnPlayerSpawn
Is there wrong?
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;
}