Raised This Month: $ Target: $400
 0% 

[HOWTO] Ingame Browser


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Tobi17
Senior Member
Join Date: May 2005
Old 05-09-2007 , 18:33   [HOWTO] Ingame Browser
Reply With Quote #1

Hello,

to display external urls for clients within the ingame browser you have to execute the following code:

Code:
public OnPluginStart() 
{
	RegServerCmd("my_browse", my_browse);
}


public Action:my_browse(args)
{
	if (args < 2) {
		PrintToServer("Usage: my_browse <userid><url> - open client ingame browser");
		return Plugin_Handled;
	}

	decl String:client_id[32];
	GetCmdArg(1, client_id, 32);

	new String:client_url[192];
	decl String:argument_string[512];
	GetCmdArgString(argument_string, 512);
	new find_pos = StrContains(argument_string, "http://", true);
	if (find_pos == -1) {
		new argument_count = GetCmdArgs();
		for(new i = 1; i < argument_count; i++) {
			decl String:temp_argument[192];
			GetCmdArg(i+1, temp_argument, 192);
			if ((192 - strlen(client_url)) > strlen(temp_argument)) {
				strcopy(client_url[strlen(client_url)], 192, temp_argument);
			}
		}
	} else {
		strcopy(client_url, 192, argument_string[find_pos]);
	}

	new client = StringToInt(client_id);
	if (client > 0) {
		new player_index = GetClientOfUserId(client);
		if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientConnected(player_index))) {
			decl Handle:hBf;
			hBf = StartMessageOne("VGUIMenu", player_index);
			if (hBf != INVALID_HANDLE) {
				BfWriteString(hBf, "info");
				BfWriteByte(hBf,   1);
				BfWriteByte(hBf,   3);
				BfWriteString(hBf, "title");
				BfWriteString(hBf, "MyTitle");
				BfWriteString(hBf, "type");
				BfWriteString(hBf, "2");
				BfWriteString(hBf, "msg");
				BfWriteString(hBf, client_url);
				BfWriteString(hBf, "cmd");
				BfWriteString(hBf, "");
				EndMessage();
			}
		}	
	}		
			
	return Plugin_Handled;
}
This could be maybe useful for anyone.

Bye
Tobi

Last edited by Tobi17; 05-09-2007 at 18:43.
Tobi17 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode