07.11.2011, 15:03
I haven't made that many loops before, and the loops I've made has been pretty simple.
I does work, but it also affects the players that types the command, and I want it to only affect the players around the player who types in the command.
It's just something I made for fun I guess, a piece where a player have to type in their name, and then the other players in range, can see his name.
pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(strfind(result, NameTagInfo[playerid][nFirstName], true) != -1 || strfind(result, NameTagInfo[playerid][nLastName], true) != -1)
{
while(GetDistanceBetweenPlayers(playerid, i) < 10)
{
if(NameTagInfo[i][nFriend1] == 0)
{
NameTagInfo[i][nFriend1] = PlayerInfo[playerid][pSQLID];
SaveFriends(i);
}
else if(NameTagInfo[i][nFriend2] == 0)
{
SendClientMessage(i, COLOR_YELLOW, "It didn't work");
SendClientMessage(playerid, COLOR_YELLOW, "It didn't work");
}
}
SendClientMessage(playerid, COLOR_YELLOW, "It worked!");
return 1;
}
}
return true;
It's just something I made for fun I guess, a piece where a player have to type in their name, and then the other players in range, can see his name.