Jump to content

Recommended Posts

Posted (edited)

hello i wanna put a random amount in my line

my codes:

new Float:REH[] =
{
    (3, 234.60, 1187.81, 1080.25),
    (10, 24.37, 1341.18, 1084.37),
    (9,84.92,1324.29,1083.8),
    (6,234.28,1065.22,1084.21)
};

my funaction:

forward GTP(playerid,interior,Float:x,Float:y,Float:z);
public GTP(playerid,interior,Float:x,Float:y,Float:z)
{
    SetPlayerInterior(playerid,interior);
    SetPlayerPos(playerid,x,y,z);
    return 1;
}

forward GTP(playerid,interior,Float:x,Float:y,Float:z);
public GTP(playerid,interior,Float:x,Float:y,Float:z)
{
	SetPlayerInterior(playerid,interior);
	SetPlayerPos(playerid,x,y,z);
	return 1;
}

my line:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new rand = random(sizeof(REH));
    if(response)
    {
     switch(dialogid)
     {
      case DIALOG_EMARAT:
      {
       switch(listitem)
       {
       case 0: GTP(playerid,REH[rand][0],REH[rand][1],REH[rand][2],REH[rand][3]); //its line 144
       }
      }
     }
	}
}

error:

E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : warning 213: tag mismatch
E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : error 001: expected token: ",", but found "["
E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : warning 215: expression has no effect
E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : error 001: expected token: ";", but found "]"
E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : error 029: invalid expression, assumed zero
E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : fatal error 107: too many error messages on one line
 

Edited by sina alex
Posted (edited)
new Float:REH[][4] =
{
    {3, 234.60, 1187.81, 1080.25},
    {10, 24.37, 1341.18, 1084.37},
    {9,84.92,1324.29,1083.8},
    {6,234.28,1065.22,1084.21}
};

 

Edited by irinelbro69
Posted (edited)

do it like this

enum reh_info {
	rehInterior,
	Float:rehX,
	Float:rehY,
	Float:rehZ
}
new REH[4][reh_info] =
{
    {3, 234.60, 1187.81, 1080.25},
    {10, 24.37, 1341.18, 1084.37},
    {9,84.92,1324.29,1083.8},
    {6,234.28,1065.22,1084.21}
};
case DIALOG_EMARAT: {
	new rand = random(sizeof REH);
	switch(listitem) {
		case 0: GTP(playerid,REH[rand][rehInterior],REH[rand][rehX],REH[rand][rehY],REH[rand][rehZ]); //its line 144
	}
}

 

Edited by nobilzeus
  • Thanks 1
Posted
18 hours ago, nobilzeus said:

do it like this

enum reh_info {
	rehInterior,
	Float:rehX,
	Float:rehY,
	Float:rehZ
}
new REH[4][reh_info] =
{
    {3, 234.60, 1187.81, 1080.25},
    {10, 24.37, 1341.18, 1084.37},
    {9,84.92,1324.29,1083.8},
    {6,234.28,1065.22,1084.21}
};
case DIALOG_EMARAT: {
	new rand = random(sizeof REH);
	switch(listitem) {
		case 0: GTP(playerid,REH[rand][rehInterior],REH[rand][rehX],REH[rand][rehY],REH[rand][rehZ]); //its line 144
	}
}

 

its look a right structure code but my dialog response wont work now when DIALOG_EMARAT choosed

 

Posted
4 minutes ago, nobilzeus said:

if its not working, look for listitem in that switch, you have there only case 0

do i need more than one case to listitem work correctly?

Posted

i just change switchs to if but still not work

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
//	new rand = random(sizeof REH);
	if(response)
	{
	 if (dialogid == DIALOG_INLISTNAMES)
	  {
	    if (listitem == 0)
	    {
	    ShowPlayerDialog(playerid, DIALOG_MANAZEL, DIALOG_STYLE_LIST, "List Interior ha","Emarat\nMamooli\nKoochik", "Entekhab", "Khorooj");
	    }
      }
	 if (dialogid == DIALOG_MANAZEL)
	  {
	    if (listitem == 0)
	    {
  	   	 ShowPlayerDialog(playerid, DIALOG_DOLATI, DIALOG_STYLE_LIST, "List Interior ha","Emarat\nMamooli\nKoochik", "Entekhab", "Khorooj");
		}
	  }
	 }
}

 

Posted

but its interesting when i click but 2 on the first dialog message spawned with cmd the server got close connection

i think it will move and read from my register system

 

  • sina alex changed the title to [FIXED] choose random cord

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.