• Need Help! How to make the muder spawn with certain weapons depending on rank (Murder)
    45 replies, posted
Hey Guys! I am a noob lua coder, i am looking to code a function on my server where if your a admin, mod, vip, or donater etc.... you would spawn with a different knife as murder (making stuff more intresting). E.g if i was a superadmin, i spawn as murder with a katana insted of a knife... if i was donator i spawn with a karambit (a fancy knife) insted of a regular one. i have not started, i dont not want to skrew up my server with lua errors. I do not have a private server to test stuff. If someone could help me out, by maybe posting what my code should look like. Help me out with some hooks. That would be GREATLY appreciated! Thanks guys!
[QUOTE]I do not have a private server to test stuff. [/QUOTE] Singleplayer. [lua]WeaponEquip -- When weapon is equipped (so it'll swap it) [/lua] Create the weapon entities (just copy the knifes code but change the weapons model and holdtype, as well as sound) And basically if you're using ulx then [lua]if ply:IsUsergroup("superdooperpay4admin") then ply:Give("superleetkatana") end[/lua]
Ty soo much! ill test it and get back to you! ;) [editline]14th March 2014[/editline] wait, sorry again. where does this go? :D
Serverside.
lol... i might seem like a total noob, but what exact file name? ;D
He didn't give you exact code. You'll have to find where in the code murderers are given weapons, and from there, add the if statement he provided.
ok, ty! helped out alot ;) [editline]15th March 2014[/editline] [IMG]http://puu.sh/7vYGx.png[/IMG] Thats my code. I tried it, nothing showed up! no new katana slot, or anything just the knife. Please help! Thank you ;)
[QUOTE=JewishZebra;44241998]ok, ty! helped out alot ;) [editline]15th March 2014[/editline] [IMG]http://puu.sh/7vYGx.png[/IMG] Thats my code. I tried it, nothing showed up! no new katana slot, or anything just the knife. Please help! Thank you ;)[/QUOTE] Try this [CODE] function GM:PlayerLoadout(ply) ply:Give("weapon_rp_hands") --ply:Give("weapon_fists") if ply:GetMurderer() and ply:IsUserGroup("superadmin") then ply:Give("katana") elseif ply:GetMurderer() and ply:IsUserGroup("donator") then ply:Give("karambit") elseif ply:GetMurderer() then ply:Give("weapon_mu_knife") end end [/CODE]
thanks alot! ^^ [editline]15th March 2014[/editline] Will try and get back to you on if it works
Do you have a weapon with the name "katana" or do you just have a model?
[IMG]http://puu.sh/7wlMq.png[/IMG] would i use the "v_katana"? or how exacly do i find the name?
You only have the model files, you need an actual swep.
yea, like i have one from the workshop[IMG]http://puu.sh/7wmcs.png[/IMG] [IMG]http://puu.sh/7wmdG.png[/IMG] [editline]15th March 2014[/editline] [IMG]http://puu.sh/7wmkM.png[/IMG] [editline]15th March 2014[/editline] [IMG]http://puu.sh/7wnZW.png[/IMG] i have named folders in both the same name as the "mu_knife" but i changed the name to "mu_katana" i copied the stuff from the knife files and changed the files and names to the katana. i am working on the entities. [editline]15th March 2014[/editline] soo, im super admin and i get the Katana!!. but users dont get a knife please help! I Changed the code back to the regular one and they still dont get a knife!
I dont understand the picture It's a knife?
ok, cut out the pic... my problem is. super admins get the katana. but if a user is murder they dont get a knife at all
Is "weapon_mu_knife" a valid knife SWEP?
^^ yup! its the defult knife! [editline]15th March 2014[/editline] Also another problem is when you throw the katana as a superadmin, when you pick it back up its a defult knife
1. Who doesn't get a weapon as a murderer? Admins? Donators? Normal users. 2. That's an issue with the script using knife ammo for the katana.
do i use katana ammo?? :D and normal users dont get the knife
You'd probably have to change it to throw an actual Katana entity. Also, I have no idea why normal murderers aren't getting the knife. The only cause I could think of would be that weapon_mu_knife isn't the exact weapon name.
is there any way you could show me how to make it to throw the katana entity
Can you post the Katana code?
like the workshop file?
No, the lua code. Unpack the workshop .gma using [URL="http://www.treesoft.dk/gmod/gmad/"]GMad[/URL] and post the SWEP code.
[url]https://www.dropbox.com/sh/ivbon6q2hd4ayia/PZVCaThdCE[/url] You can download it there, unpacked
Bump! [editline]16th March 2014[/editline] [IMG]http://puu.sh/7xXiQ.png[/IMG] this is what i got and now when i go in game you cant join a team (murder or bystander), says not enough plays to start. When i try to join a team is says Unknown Command "mu_jointeam"
[QUOTE=JewishZebra;44256568]Bump! [editline]16th March 2014[/editline] [IMG]http://puu.sh/7xXiQ.png[/IMG] this is what i got and now when i go in game you cant join a team (murder or bystander), says not enough plays to start. When i try to join a team is says Unknown Command "mu_jointeam"[/QUOTE] Off topic, But what sublime theme is that?
On line 93 You're calling ply:GetMurder() instead of ply:GetMurderer()
[QUOTE=JewishZebra;44256568]Bump! [editline]16th March 2014[/editline] [IMG]http://puu.sh/7xXiQ.png[/IMG] this is what i got and now when i go in game you cant join a team (murder or bystander), says not enough plays to start. When i try to join a team is says Unknown Command "mu_jointeam"[/QUOTE] Use Handsome Matt's code. You're calling GetMurder instead of GetMurderer, and you're still overriding a default gamemode function. Use a hook.
ok, ty for pointing out the small error, i wasnt paying attention. i will try his code. then give you the results. but how do you the code in the chat insted of a pic?
Sorry, you need to Log In to post a reply to this thread.