I found this script somewhere else on this website. It works, but only when a person is dead. If the player is alive and they type !donate nothing happens, any idea why this is happening, or how I can fix it?
Thanks!
[code]local donate = {
["URL"] = "MY URL IS HERE"
};
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]
There's something different on your server that's blocking it.
Also just tried this code and the same thing happens. What could be blocking it?
If a player is alive they will print the "has gone to donate" message, but no windows open unless they are dead or in spectate.
[code]function donateCommand( pl, text, teamonly )
if (text == "!donate") then
pl:SendLua([[gui.OpenURL("MY URL")]]) -- Change ADDRESS to your chosen page.
for k, v in pairs(player.GetAll()) do v:ChatPrint( "Player " .. pl:Nick() .. " has gone to donate!" )
end
end
end
hook.Add( "PlayerSay", "dcommand", donateCommand )[/code]
[editline]6th January 2014[/editline]
Update
This code seems to work if your alive or dead, but if I use https (which I need to), it won't work... Could I make this work with my https url any way?
[code]hook.Add( "PlayerSay", "DonatePlayerSay", function( pl, str, isteam )
if( string.sub( str, 1, 7 ) == "!test" ) then
pl:SendLua([[gui.OpenURL("MY URL HERE")]]);
PrintMessage( HUD_PRINTTALK, pl:Nick() .. " has gone to !donate" );
return "";
end
end );[/code]
EDIT FINAL
Got the last code I posted ^^ working by shorting the url with google instead of using my https url
Sorry, you need to Log In to post a reply to this thread.