General > Developers Corner

Help with a command

(1/1)

[SC] Paul:
I want a command to open my donations page without players having to tab out I was using this

--- Quote from: bender180 on December 13, 2012, 11:23:05 AM ---
--- Code: ---function donateCommand( pl, text, teamonly )
    if (text == "!donate") then
    pl:SendLua([[gui.OpenURL("http://myurl.com/donate")]]) -- Change ADDRESS to your chosen page.
    for k, v in pairs(player.GetAll()) do v:ChatPrint( "Player " .. pl:Nick() .. " has donated to the server via !donate" )

end
end
end
hook.Add( "PlayerSay", "Chat", donateCommand )
--- End code ---

--- End quote ---
All it done was display the text "Player Paul has donated to the server via !donate" does anyone know what i could do to fix this?

bender180:
Here this should be working ( at least it does on my server.)

Also make sure you put it in lua/autorun


--- Code: ---function donateCommand( pl, text, teamonly )
    if (text == "!donate") then
    pl:SendLua([[gui.OpenURL("http://bendersvilla.net")]]) -- Change ADDRESS to your chosen page.
    for k, v in pairs(player.GetAll()) do v:ChatPrint( "" .. pl:Nick() .. " has gone to !donate." )

end
end
end
hook.Add( "PlayerSay", "ccdonate", donateCommand )
--- End code ---

[SC] Paul:
That worked thanks! :D

Navigation

[0] Message Index

Go to full version