Mrzeerox Posted November 17, 2016 Share Posted November 17, 2016 Can anyone make me text on head "Admin On Duty [No Shooting]"? Also. Can anyone make me script, if you are around 100m then anyone can't equip weaons and shoot? function giveblood (thePlayer) local account = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup("user." .. account, aclGetGroup("Admin,Moderator,Owner")) then end outputChatBox ("#1AFF00 Admin "..getPlayerName(thePlayer).."#1AFF00IS NOW - ON DUTY",root,255,255,255,true) setElementData(thePlayer, "blood",999999999) setElementData(thePlayer, "food",95) setElementData(thePlayer, "thirst",95) setElementData(thePlayer, "temperature",36.5) setElementData(thePlayer, "currentweapon_1",false) setElementData(thePlayer, "currentweapon_2",false) setElementData(thePlayer, "currentweapon_3",false) setElementData(thePlayer, "bleeding",false) setElementData(thePlayer, "brokenbone",false) setElementData(thePlayer, "pain",false) setElementData(thePlayer, "cold",false) setElementData(thePlayer, "humanity",2500) end addCommandHandler("duty", giveblood) function bloodback(thePlayer) local account = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup("user." .. account, aclGetGroup("Admin,Moderator,Owner")) then end outputChatBox ("#FF0000 Admin "..getPlayerName(thePlayer).."#FF0000IS NOW - OFF DUTY",root,255,255,255,true) setElementData(thePlayer, "blood",12000) end addCommandHandler("offduty", bloodback) Link to comment
LoPollo Posted November 17, 2016 Share Posted November 17, 2016 (edited) I can't understand what this means: if isObjectInACLGroup("user." .. account, aclGetGroup("Admin,Moderator,Owner")) then end Text: To make a text on the head of someone you could make a clientside script that checks if the admin is on duty (and if he is then draw the text) setElementData(...) getElementData(...) dxCreateRenderTarget(...) dxSetRenderTarget(...) dxDrawText(...) addEventHandler( "onClientRender", ...) Weapons: getDistanceBetweenPoints3D(...) giveWeapon(...) --use triggers to use it client side if you really need to otherwise --if you make this script serverside you can replace getDistance... with colshapes createColSphere(...) attachElements(...) addEventHandler("onColShapeHit", ...) --you can use colshapes in clientside to but it require additional work to handle them (streaming) Another solution is to prevent them from shooting setControlState(...) Edited November 17, 2016 by LoPollo Link to comment
Mrzeerox Posted November 17, 2016 Author Share Posted November 17, 2016 I do not know how to script yet. I can only basic things. So, can you make it for me? PLs? Link to comment
LoPollo Posted November 17, 2016 Share Posted November 17, 2016 (edited) If i make it for you, next time you won't still be able to script. Read the wiki to learn the funcs, read resources so you can quickly learn lua and mta basics. The thing you want to achieve is not far from you, it's easy and you can make it: it's a very good starting point. Let's write something and check the logs to see where you wrote syntax errors, in little scripts these are near 100% of problems you can encounter. You will eventually get the "logic" and learn to convert that thought to a working script. We can help through this, but it's hard someone will make the entire script for you for free (even if i've seen this happening). Start reading the examples in the wiki and other simple scripts, write something, check if it works, and if not reply here: we're still here to help! Good luck Quote NOTE: Please remember that this is not a forum for requests. We can help you with your code or question but we will not script for you. Edited November 17, 2016 by LoPollo Link to comment
Mrzeerox Posted November 17, 2016 Author Share Posted November 17, 2016 addEventHandler( "onClientRender", root, function () plrs = getElementsByType'thePlayer' for i=1,#plrs do if getElementData(plrs[i], "OnDuty") and plrs[i] ~= localPlayer then dxDrawTextOnElement(plrs[i],"]-Pie clan-[",1,30,255,255,255,255,3,"default-bold") end end end ) function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font) local distance = distance or 20 local height = height or 1 local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getCameraMatrix() local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawText(text, sx+4, sy+4, sx, sy, tocolor(0, 0, 0, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") dxDrawText(text, sx, sy, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") end end end function giveblood (thePlayer) local account = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin") ) then if not getElementData(thePlayer, "OnDuty") then end outputChatBox ("#1AFF00 Admin "..getPlayerName(thePlayer).."#1AFF00IS NOW - ON DUTY",root,255,255,255,true) setElementData(thePlayer, "blood",999999999) setElementData(thePlayer, "food",95) setElementData(thePlayer, "thirst",95) setElementData(thePlayer, "temperature",36.5) setElementData(thePlayer, "currentweapon_1",false) setElementData(thePlayer, "currentweapon_2",false) setElementData(thePlayer, "currentweapon_3",false) setElementData(thePlayer, "bleeding",false) setElementData(thePlayer, "brokenbone",false) setElementData(thePlayer, "pain",false) setElementData(thePlayer, "cold",false) setElementData(thePlayer, "bandit",false) setElementData(thePlayer, "humanity",2500) setElementData(thePlayer, "skin",210) end addCommandHandler("duty", giveblood) end function bloodback(thePlayer) local account = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup("user." .. account, aclGetGroup("Admin,Moderator,Owner")) then end outputChatBox ("#FF0000 Admin "..getPlayerName(thePlayer).."#FF0000IS NOW - OFF DUTY",root,255,255,255,true) setElementData(thePlayer, "blood",12000) end addCommandHandler("offduty", bloodback) end I have something worng here. Can you help me? Link to comment
Strike27208 Posted November 20, 2016 Share Posted November 20, 2016 (edited) Use this man toggleControl ( thePlayer, "aim_weapon", false ) -- disable their fire key toggleControl ( thePlayer, "fire", false ) -- disable their fire key --------------------------------------------------------------------- toggleControl ( thePlayer, "aim_weapon", true ) -- enable their fire key toggleControl ( thePlayer, "fire", true ) -- enable their fire key Edited November 20, 2016 by Strike27208 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