Jump to content

[FIXED] choose random cord


sina alex

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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");
		}
	  }
	 }
}

 

Link to comment
Share on other sites

  • 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.