• How do I do this code does not affect the superadmin?
    13 replies, posted
fixed
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/IsSuperAdmin]Player:IsSuperAdmin[/url]
[CODE] local function spawn( ply ) if !ply:IsSuperAdmin() then ply:SendLua([[gui.OpenURL("http://clanpyth0nn.blogspot.com.br")]]) end end hook.Add( "PlayerSpawn", "SendLua", spawn ) [/CODE] going off of the top of my head, and using [url=http://wiki.garrysmod.com/?title=Player.IsSuperAdmin]Player.IsSuperAdmin [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [URL="https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5050.html"]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5050.html[/URL] [editline]3rd February 2017[/editline] ninja'd
Why are you using SendLua when you can just call gui.OpenURL directly on the client? Just do 'gui.OpenURL("url")' in an autorun client file.
thanks everbody Hey, I need help with one more thing [CODE] function SlayPlayerNoclip( ply, killer ) if ply ~= killer then if killer:GetMoveType() == MOVETYPE_NOCLIP then ply:kill() end end end hook.Add( "PlayerDeath", "kill", SlayPlayerNoclip ) [/CODE] February 2017 9 Posts i want a lua code, slay player when player kill other player using noclip
[QUOTE=hwplays;51771180]thanks everbody Hey, I need help with one more thing [CODE] function SlayPlayerNoclip( ply, killer ) if ply ~= killer then if killer:GetMoveType() == MOVETYPE_NOCLIP then ply:kill() end end end hook.Add( "PlayerDeath", "kill", SlayPlayerNoclip ) [/CODE] February 2017 9 Posts i want a lua code, slay player when player kill other player using noclip[/QUOTE] What do you need help with about it?
just.. not found :P
[QUOTE=hwplays;51771209]just.. not found :P[/QUOTE] You got an answer in the thread.
:P This code don't found, i stay killing players in noclip :P [CODE] function SlayPlayerNoclip( ply, killer ) if ply ~= killer then if killer:GetMoveType() == MOVETYPE_NOCLIP then ply:kill() end end end hook.Add( "PlayerDeath", "kill", SlayPlayerNoclip ) [/CODE] why i need make ? ;-;
[QUOTE=hwplays;51771250]:P This code don't found, i stay killing players in noclip :P [CODE] function SlayPlayerNoclip( ply, killer ) if ply ~= killer then if killer:GetMoveType() == MOVETYPE_NOCLIP then ply:kill() end end end hook.Add( "PlayerDeath", "kill", SlayPlayerNoclip ) [/CODE] why i need make ? ;-;[/QUOTE] [QUOTE=code_gs;51769769]Your argument order is wrong; reference the wiki page: [url]https://wiki.garrysmod.com/page/GM/PlayerDeath[/url][/QUOTE]
. [editline]3rd February 2017[/editline] Now i maked this [CODE] function NoclipKill( victim, attacker ) if ( victim == attacker ) then if attacker:GetMoveType() == MOVETYPE_NOCLIP then attacker:kill() end end end hook.Add( "PlayerDeath", NoclipKill ) [/CODE] but stay not found :/
It's because your argument "attacker" is actually the weapon that attacked the player, not the attacker. Read the wiki [url]https://wiki.garrysmod.com/page/GM/PlayerDeath[/url] as code_gs pointed out. You need the 3rd argument which will be the actual player that attacked the victim. Also "kill" should be "Kill".
To be more clear, this is incorrect: [CODE]function NoclipKill( victim, attacker )[/CODE] This, is correct: [CODE]function NoclipKill( victim, inflictor, attacker )[/CODE] Reference this example code: [CODE]function GM:PlayerDeath( victim, inflictor, attacker ) if ( victim == attacker ) then PrintMessage( HUD_PRINTTALK, victim:Name() .. " committed suicide." ) else PrintMessage( HUD_PRINTTALK, victim:Name() .. " was killed by " .. attacker:Name() .. "." ) end end [/CODE] And if someone could fact check me, does this imply the player is killing themself? [CODE]if ( victim == attacker ) then[/CODE]
Sorry, you need to Log In to post a reply to this thread.