SA-MP Forums Archive
Help me! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help me! (/showthread.php?tid=655941)



REPAIRED - Libbyphay - 03.07.2018

Delete


Re: Help me! - jasperschellekens - 03.07.2018

You can create a loop for example something like this:

PHP код:
#define MAXINDEX 4

stock PhoneShowSystem(playeridindexstring[])
{
        for(new 
0;d<MAXINDEX;d++)
    {
            new 
index d;
        
PlayerTextDrawSetString(playeridPhoneList1[index][playerid], string);
        
PlayerTextDrawShow(playeridPhoneList1[index][playerid]);
    }
    return 
1;




Re: Help me! - Libbyphay - 03.07.2018

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
You can create a loop for example something like this:

PHP код:
#define MAXINDEX 4
stock PhoneShowSystem(playeridindexstring[])
{
        for(new 
0;d<MAXINDEX;d++)
    {
            new 
index d;
        
PlayerTextDrawSetString(playeridPhoneList1[index][playerid], string);
        
PlayerTextDrawShow(playeridPhoneList1[index][playerid]);
    }
    return 
1;

i want index = 0 to 4 =>
Код:
#define MAXINDEX 5
stock PhoneShowSystem(playerid, index, string[])
{
        for(new d = 0;d<MAXINDEX;d++)
	{
        	index = d;
		PlayerTextDrawSetString(playerid, PhoneList1[index][playerid], string);
		PlayerTextDrawShow(playerid, PhoneList1[index][playerid]);
	}
	return 1;
}
But it is working all = 4 how to fix it?


Re: Help me! - Libbyphay - 03.07.2018

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
You can create a loop for example something like this:

PHP код:
#define MAXINDEX 4
stock PhoneShowSystem(playeridindexstring[])
{
        for(new 
0;d<MAXINDEX;d++)
    {
            new 
index d;
        
PlayerTextDrawSetString(playeridPhoneList1[index][playerid], string);
        
PlayerTextDrawShow(playeridPhoneList1[index][playerid]);
    }
    return 
1;

I fix it through, it working.

Код:
stock PhoneShowSystem(playerid, index, string[])
{
    if(index == 0)
    {
        PlayerTextDrawSetString(playerid, PhoneList1[0][playerid], string);
        PlayerTextDrawShow(playerid, PhoneList1[0][playerid]);
    }
    else if(index == 1)
    {
        PlayerTextDrawSetString(playerid, PhoneList1[1][playerid], string);
        PlayerTextDrawShow(playerid, PhoneList1[1][playerid]);
    }
    else if(index == 2)
    {
        PlayerTextDrawSetString(playerid, PhoneList1[2][playerid], string);
        PlayerTextDrawShow(playerid, PhoneList1[2][playerid]);
    }
    else if(index == 3)
    {
        PlayerTextDrawSetString(playerid, PhoneList1[3][playerid], string);
        PlayerTextDrawShow(playerid, PhoneList1[3][playerid]);
    }
    else if(index == 4)
    {
        PlayerTextDrawSetString(playerid, PhoneList1[4][playerid], string);
        PlayerTextDrawShow(playerid, PhoneList1[4][playerid]);
    }
    return 1;
}