I am trying to do a !donate command and bring up a web page for the paypal. I keep getting lua errors but the windows pops up blank. Also the window is on the top left of the screen is there a way to have it centered?
ERROR
[CODE][ERROR] lua/autorun/client/donate.lua:22: bad argument #1 to 'OpenURL' (string e
xpected, got nil)
1. OpenURL - [C]:-1
2. CreatePanel - lua/autorun/client/donate.lua:22
3. fn - lua/autorun/client/donate.lua:36
4. Call - addons/ulib/lua/ulib/shared/hook.lua:183
5. Function - gamemodes/darkrp/gamemode/cl_init.lua:262
6. unknown - lua/includes/modules/usermessage.lua:87[/CODE]
CODE
[CODE]local donate = {
["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HESJEG3LRYHL8"] = "";
};
function donate.CreatePanel( )
local w = 800; -- Width
local h = 600; -- Height
local p = 8; -- Padding
donate.Frame = vgui.Create( "DFrame" );
donate.Frame:SetTitle( "Donate" );
donate.Frame:SetSize( w + (p * 2), h + (p * 5) );
donate.Panel = vgui.Create( "DPanel", donate.Frame );
donate.Panel:SetPos( 8, 32 );
donate.Panel:SetSize( w, h );
donate.HTML = vgui.Create( "HTML", donate.Panel );
donate.HTML:SetPos( 8, 8 );
donate.HTML:SetSize( w - (p * 2), h - (p * 2) );
donate.HTML:OpenURL( donate.URL );
donate.Frame:Center();
donate.Frame:MakePopup();
end
hook.Add( "OnPlayerChat", "donateCommand", function( ePlayer, sText )
if ( ePlayer ~= LocalPlayer() ) then
return;
end
if ( string.StartWith( string.lower( sText ), "!donate" ) ) then
donate.CreatePanel( );
return;
end
end );[/CODE]
Did you even read the error?
[lua]local donate = {
URL = ["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HESJEG3LRYHL8"]
}[/lua]
I did but I know nothing about lua.
nevermind, didn't look at the derma.
[QUOTE=OzymandiasJ;42229502]Did you even read the error?
[lua]local donate = {
URL = ["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HESJEG3LRYHL8"]
}[/lua][/QUOTE]
After doing that I received this error but this time when I put in the command nothing happens..
[CODE][ERROR] lua/autorun/client/donate.lua:2: unexpected symbol near '['
1. unknown - lua/autorun/client/donate.lua:0
[/CODE]
[lua]
local donate = {
["URL"] = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HESJEG3LRYHL8"
}
[/lua]
[QUOTE=Bo98;42236167][lua]
local donate = {
["URL"] = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HESJEG3LRYHL8"
}
[/lua][/QUOTE]
Thank you so much! Worked!
Sorry, you need to Log In to post a reply to this thread.