#1

loops in samp are weird. it's supposed to show the client message if the dialog is empty (no players with wanted level) but it shows up no matter what. what is going on? :<

Код:
		if(GetPlayerWantedLevel(i) > 0)
		{
			format(strx, 64, "%s (ID: %d)\n", name, i);
			strcat(stry, strx);
			
			ShowPlayerDialog(playerid, boop1, DIALOG_STYLE_LIST, "wanted", stry, "OK", "");
		}
		else if(GetPlayerWantedLevel(i) < 1)
		{
			SendClientMessage(playerid, -1, "boop no wanted");
			break;
		}
Reply
#2

pawn Код:
if(GetPlayerWantedLevel(i) >= 1)
        {
            format(strx, 64, "%s (ID: %d)\n", name, i);
            strcat(stry, strx);
           
            ShowPlayerDialog(playerid, boop1, DIALOG_STYLE_LIST, "wanted", stry, "OK", "");
        }
        else return SendClientMessage(playerid, -1, "boop no wanted");
Reply
#3

It won't make a difference :<
Reply
#4

Show us more like the loop maybe?
Reply
#5

Quote:
Originally Posted by cdoubleoper
Посмотреть сообщение
It won't make a difference :<
Do you tried?
Reply
#6

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
Show us more like the loop maybe?
It's everything in this simple loop
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Reply
#7

Quote:

new x=0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerWantedLevel(i) > 0)
{
format(strx, 64, "%s (ID: %d)\n", name, i);
strcat(stry, strx);
x++;
ShowPlayerDialog(playerid, boop1, DIALOG_STYLE_LIST, "wanted", stry, "OK", "");
}
}
if(x==0) SendClientMessage(playerid, -1, "boop no wanted");

try now
Reply
#8

This is pointless. There has to be a proper way to do it in pawn.
Reply
#9

use foreach, Iterator and Iter_Count
Reply
#10

Код:
	new Iterator:wanted<10>; 
	foreach(new i : wanted) 
	{
		if(GetPlayerWantedLevel(i) > 0)
		{
			Iter_Add(wanted, 1); 
		}
		if(!Iter_Count(wanted))return SendClientMessage(playerid, -1, "boop no wanted");
		else
		{
			Iter_Clear(wanted);
			foreach(new i : wanted)
			{
				if(GetPlayerWantedLevel(i) > 0)
				{
					Iter_Add(wanted, 1); 
					format(strx, 64, "%d. %s (ID: %d)\n",Iter_Count(wanted), name, i);
					strcat(stry, strx);
				}
			}
			ShowPlayerDialog(playerid, boop1, DIALOG_STYLE_LIST, "wanted", stry, "OK", "");
		}
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)