SA-MP Forums Archive
How can i limit the results of the teleport dialog? - 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: How can i limit the results of the teleport dialog? (/showthread.php?tid=574666)



How can i limit the results of the teleport dialog? - Metharon - 19.05.2015

I want if there are 10 + teleports , to create an dialog "Go to page 2" .. ?


http://i.imgur.com/1QZS8EA.jpg

I want to create more teleports...


Re: How can i limit the results of the teleport dialog? - Threshold - 19.05.2015

Can we see your code? :l


Re: How can i limit the results of the teleport dialog? - Metharon - 19.05.2015

Код:
	if(strcmp(cmd, "/createteleport", true) == 0 || strcmp(cmd, "/createtp", true) == 0)
	{
	    if(PlayerInfo[playerid][pAdmin] > 3)
	    {
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /createteleport [tp name]");
				return 1;
			}
			new i = sTeleports + 1;
		    new Float:x, Float:y, Float:z, Float:angle,interior,vw;
		    GetPlayerPos(playerid, x, y, z);
		    GetPlayerFacingAngle(playerid, angle);
			interior = GetPlayerInterior(playerid);
			vw = GetPlayerVirtualWorld(playerid);
			TeleInfo[i][tpEnabled] = 1;
			format(TeleInfo[i][tpOwner], 256, "%s", GetName(playerid));
			format(TeleInfo[i][tpName], 256, "%s", result);
			TeleInfo[i][TPX] = x;
			TeleInfo[i][TPY] = y;
			TeleInfo[i][TPZ] = z;
			TeleInfo[i][TPAngle] = angle;
			TeleInfo[i][tpInterior] = interior;
			TeleInfo[i][tpVirtualWorld] = vw;
			format(string, sizeof(string), "{DC0C0C}(Teleport) {FF6633}%s a creat teleportul %s.", GetName(playerid), result);
			ABroadCast(RED, string, 1);
			format(string,sizeof(string), "INSERT INTO `teleports` ( ID, Name , Owner, X, Y, Z, Angle, Interior) VALUES ( %d,'%s','%s',%f,%f,%f,%f,%d )", i, TeleInfo[i][tpName], x,y,z,angle,TeleInfo[i][tpInterior]);
			mysql_tquery(mysql, string, "", "");
			sTeleports ++;
		}
		return 1;
	}
    if (strcmp(cmd, "/tplist", true) == 0 || strcmp(cmd, "/teleports", true) == 0)
	{
        if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] > 1)
	    {
            new count = 0;
 		 	new stringx[766];
 		 	format(stringx, sizeof(stringx), "Nume destinatie\tCreator\n");
	 		for(new i = 0; i < MAX_TELEPORTS; i++)
			{
				if(TeleInfo[i][tpEnabled] == 1)
				{
			 		format(stringx, sizeof(stringx), "%s\n{FFFFFF}%s\t{00CC33}%s\n", stringx,TeleInfo[i][tpName],TeleInfo[i][tpOwner]);
			 		count++;

				}
	 		}
	 		if(count == 0)
	 		{
	 			format(stringx, sizeof(stringx), "Nume destinatie\tCreator\n{FF6633}Nu sunt teleporturi create din pacate.");
	 		}
	 		new string2[456];
	 		format(string2, sizeof(string2), "Lista de teleportare (%d in total)", count);
			ShowPlayerDialog(playerid, DIALOG_TPLIST,  DIALOG_STYLE_TABLIST_HEADERS, string2, stringx, "Teleport", "Cancel");

		}
		return 1;
	}



Re: How can i limit the results of the teleport dialog? - Vitos - 19.05.2015

I think that you could do instead of the "Cancel" button you make it an arrow you go to another dialog, it works with regular textdraws with public OnPlayerClickPlayerTextdraw and dialog is a type of textdraw so I guess it should work in some way, I will try to find some info about it for you.