Absence2 Posted March 9, 2012 Share Posted March 9, 2012 Hey, I'm working on this Admin skin thing for my event system, would this show a nametag saying "Admin" on whoever used this command? And can I make it visible for myself? function setAdminSkin (thePlayer) if (exports.global:isPlayerFullAdmin(thePlayer)) then setPedSkin ( thePlayer, 0 ) setPedStat(thePlayer, 23, 700) setPlayerNametagShowing( root, true ) setPlayerNametagText ( root, Admin, true ) addPedClothes ( thePlayer, "tshirtproblk", "tshirt", 20 ) addPedClothes ( thePlayer, "player_face", "head", 1 ) addPedClothes ( thePlayer, "worktrcamogrn", "worktr", 2 ) addPedClothes ( thePlayer, "convproblk", "conv", 3 ) addPedClothes ( thePlayer, "neckdollar", "neck", 13 ) addPedClothes ( thePlayer, "watchcro2", "watch", 14 ) addPedClothes ( thePlayer, "boaterblk", "boater", 15 ) end end addCommandHandler ( "askin", setAdminSkin) Link to comment
Kenix Posted March 9, 2012 Share Posted March 9, 2012 (edited) setPlayerNametagText use in client side if you want show only you. setPlayerNametagText ( root, Admin, true ) Admin is defined variable? And why you use 3 arguments if have only 2. Also root not work here ( tested in run code and return false ). You should loop player elements and set name tag text . Edited March 9, 2012 by Guest Link to comment
Absence2 Posted March 9, 2012 Author Share Posted March 9, 2012 setPlayerNametagText use in client side if you want show only you. setPlayerNametagText ( root, Admin, true ) Admin is defined variable? And why you use 3 arguments if have only 2. #1 Nop, I was trying to set the text to 'Admin' but I think I covered that one. #2 I tested, sorry. I thought it would show if true and hide > false as without it didn't work, I re-checked on wiki and noticed that I did wrong. anyways, I got this now: Server: function setAdminSkin (thePlayer) if (exports.global:isPlayerFullAdmin(thePlayer)) then setPedSkin ( thePlayer, 0 ) setPedStat(thePlayer, 23, 700) setPlayerNametagShowing( root, true ) triggerClientEvent ( "tagName", getRootElement() ) addPedClothes ( thePlayer, "tshirtproblk", "tshirt", 20 ) addPedClothes ( thePlayer, "player_face", "head", 1 ) addPedClothes ( thePlayer, "worktrcamogrn", "worktr", 2 ) addPedClothes ( thePlayer, "convproblk", "conv", 3 ) addPedClothes ( thePlayer, "neckdollar", "neck", 13 ) addPedClothes ( thePlayer, "watchcro2", "watch", 14 ) addPedClothes ( thePlayer, "boaterblk", "boater", 15 ) end end addCommandHandler ( "askin", setAdminSkin) client: function tagAdminEvent () setPlayerNametagText ( root, "STAFF") end addEvent ( "tagName", true ) addEventHandler( "tagName", getRootElement(), tagAdminEvent ) No nametag is showing though Link to comment
Kenix Posted March 9, 2012 Share Posted March 9, 2012 (edited) function setAdminSkin ( thePlayer ) if exports.global:isPlayerFullAdmin( thePlayer ) then setElementModel ( thePlayer, 0 ) setPedStat( thePlayer, 23, 700 ) setPlayerNametagText ( thePlayer, 'STAFF' ) setPlayerNametagShowing( thePlayer, true ) addPedClothes ( thePlayer, 'tshirtproblk', 'tshirt', 20 ) addPedClothes ( thePlayer, 'player_face', 'head', 1 ) addPedClothes ( thePlayer, 'worktrcamogrn', 'worktr', 2 ) addPedClothes ( thePlayer, 'convproblk', 'conv', 3 ) addPedClothes ( thePlayer, 'neckdollar', 'neck', 13 ) addPedClothes ( thePlayer, 'watchcro2', 'watch', 14 ) addPedClothes ( thePlayer, 'boaterblk', 'boater', 15 ) end end addCommandHandler ( 'askin', setAdminSkin ) Ah forgot. It's change your nametag so you can't see nick name, but all see. Edited March 9, 2012 by Guest Link to comment
Absence2 Posted March 9, 2012 Author Share Posted March 9, 2012 So I can't enable the nametag for myself somehow ? Link to comment
Kenix Posted March 9, 2012 Share Posted March 9, 2012 (edited) You can create your custom name tags. Edited March 9, 2012 by Guest Link to comment
Absence2 Posted March 9, 2012 Author Share Posted March 9, 2012 You can create your custom name tags. I have those, but this is just some additional thing I intented to use in my event script for Admins vs Players events/wars. Well thanks for your help, I'll try it out with someone in a moment. Link to comment
Kenix Posted March 9, 2012 Share Posted March 9, 2012 No problem. Also in wiki have example https://wiki.multitheftauto.com/wiki/GetPedBonePosition You can use it. It draw nick name on the head. And you can see your nickname. Link to comment
Absence2 Posted March 9, 2012 Author Share Posted March 9, 2012 No problem.Also in wiki have example https://wiki.multitheftauto.com/wiki/GetPedBonePosition You can use it. It draw nick name on the head. And you can see your nickname. I noticed that the setPlayerNametagText affects my "custom" nametags so that's great! So I remade most of it into this: function setAdminSkin ( thePlayer ) local playerName = getPlayerName if exports.global:isPlayerFullAdmin( thePlayer ) then setElementModel ( thePlayer, 29 ) setPlayerNametagText ( thePlayer, '" .. playerName .. " (ADMIN)' ) end end addCommandHandler ( 'askin', setAdminSkin ) this seems to show the name ONLY,but not (ADMIN) =/ supposed to be: Idjot_Idjot (Admin) Link to comment
JR10 Posted March 9, 2012 Share Posted March 9, 2012 function setAdminSkin ( thePlayer ) if exports.global:isPlayerFullAdmin( thePlayer ) then local playerName = getPlayerName(thePlayer) setElementModel ( thePlayer, 29 ) setPlayerNametagText ( thePlayer, playerName .. " (ADMIN)" ) end end addCommandHandler ( 'askin', setAdminSkin ) Link to comment
Absence2 Posted March 9, 2012 Author Share Posted March 9, 2012 function setAdminSkin ( thePlayer ) if exports.global:isPlayerFullAdmin( thePlayer ) then local playerName = getPlayerName(thePlayer) setElementModel ( thePlayer, 29 ) setPlayerNametagText ( thePlayer, playerName .. " (ADMIN)" ) end end addCommandHandler ( 'askin', setAdminSkin ) Oh, I see, that did work, thanks Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now