Jump to content

Saml1er

Retired Staff
  • Posts

    1,058
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Saml1er

  1. Don't worry. It takes time to learn basics. You can find online tutorials for more info and also try to read the same text again and again until you understand it completely ( if you don't then feel free to ask here ) and also run script and read about elements, variables ( global and local and how you access them) on wiki. MTA has predefined variables ( like resourceRoot, root and localPlayer ).
  2. Saml1er

    I need help

    Copy my code again.
  3. Saml1er

    I need help

    local marker = createMarker(255.6, 77.3, 1003.7, "cylinder", 1.5, 0, 0, 255, 255) setElementInterior(marker, 6) function Police (player) local skin = getElementModel(player) local data = getElementData(player, "Rank") if (data == "Officer") then setElementModel(player, 284) giveWeapon(player, 3, 1) giveWeapon(player, 24, 100) giveWeapon(player, 41, 5000) end if (data == "SWAT Officer")then setElementModel(player, 285) giveWeapon(player, 3, 1) giveWeapon(player, 24, 100) giveWeapon(player, 41, 5000) else outputChatBox("You don't have access", player, 255, 0, 0) end setElementModel(player, 288) giveWeapon(player, 3, 1) giveWeapon(player, 24, 100) giveWeapon(player, 41, 5000) if (data == "Sergeant") then giveWeapon(player, 3, 1) giveWeapon(player, 24, 100) giveWeapon(player, 41, 5000) else outputChatBox("You don't have access", player, 255, 0, 0) end end addEventHandler("onMarkerHit", marker, Police) local marker = createMarker(255.6, 77.3, 1003.7, "cylinder", 1.5, 0, 0, 255, 255) setElementInterior(marker, 6) local c,o,g = nil,nil,nil function Police (player) local data = getElementData(player, "Rank") local skin = getElementModel(player) if (data == "Officer") then Window = guiCreateWindow(0.50, 0.20, 5, 6, "Select Uniform", true) guiSetVisible (Window, true) showCursor(true) guiCreateLabel(0.02, 0.08, 0.94, 0.2, "Female Uniform", true) guiCreateLabel(0.04, 0.08, 0.94, 0.2, "Street Cop 1 Uniform",true) guiCreateLabel(0.06, 0.08, 0.94, 0.2, "Street Cop 2 Uniform", true) guiCreateLabel(0.08, 0.08, 0.94, 0.2, "Street Cop 3 Uniform", true) guiCreateLabel(0.10, 0.08, 0.94, 0.2, "LS Uniform", true) guiCreateLabel(0.12, 0.08, 0.94, 0.2, "SF Uniform",true) guiCreateLabel(0.14, 0.08, 0.94, 0.2, "LV Uniform",true) guiCreateLabel(0.16, 0.08, 0.94, 0.2, "RCSD Uniform", true) guiCreateLabel(0.18, 0.08, 0.94, 0.2, "Bike Uniform", true) guiCreateLabel(0.20, 0.08, 0.94, 0.2, "SWAT Uniform", true) guiCreateLabel(0.22, 0.08, 0.94, 0.2, "BCSD Uniform", true) guiCreateLabel(0.24, 0.08, 094, 0.2, "Own Skin", true) o = guiCreateButton(1, 2, 0.94, 0.2, "OK",false , Window) g = guiCreateButton(2, 2, 0.94, 0.2, "Go off duty", false, Window) c = guiCreateButton(3, 2, 0.94, 0.2, " Cancel", false, Window) end end addEventHandler("onClientMarkerHit", marker, Police) function C() if source == c then guiSetVisisble(Window,false) showCursor(false) elseif source == o then triggerServerEvent("SAPDTeam",player) setElementData(source, "Job", "Police Officer") guiSetVisible(Window, false) showCursor(false) elseif source == g then getElementModel(player) triggerServerEvent("CitizenTeam",player) setElementData(source, "Job", "None") guiSetVisible(Window, false) showCursor(false) end end addEventHandler("onClientGUIClick", root,C)
  4. Saml1er

    I need help

    onMarkerHit is server event. Use 'onClientMarkerHit' and this should be player because source of this event is marker. local skin = getElementModel(source) take a ss of debug ( /debugscript 3 ) ingame.
  5. dxDrawText (betted.." / "..amount, x/3, y/3, x, y, tocolor (255, 255, 255))
  6. Saml1er

    I need help

    47.addEventHandelr should be addEventHandler
  7. Saml1er

    help

    local str = getPlayerName ( player ) -- make sure player is defined local FL = string.sub (str,0,-string.len(str)) outputChatBox (FL)
  8. This isn't your code, you simply took it from slothbot resource. Nice try.
  9. I don't mind helping someone for free. I think I've already added you in Skype?
  10. Why don't you simply upgrade the script? /upgrade resourceName
  11. Allright, rumors are rumors. Thanks anyways. Hmmm. So you don't agree?
  12. Open the resource and search for map tags like '[classic]' But there is a specific map tag through which script detects map type. Simply open a map from any arena tag and then open meta.xml and look for name=" ". You will find what map tag this arena use and simply if you want to add maps then add a map in arena folder and use the map tag in meta.xml ( name="[tag]mapname". Good luck.
  13. I made a code for someone. You can use it local groups = { {"Admin", "#FF0000*[ Admin ]*"}, {"Mode","#00FF00*[ Moderator ]*"} , {"vip","#ffff00*[ V.I.P ]*"} , {"Owner","#A000FF*[ Owner ]*"}, {"SubAdmin","#0000ff*[ Sub Admin ]*"}, {"Everyone", "[ Everyone ]"} } local function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end addEventHandler ( "onPlayerChat", root, function ( msg, type ) if type == 0 then for i,v in pairs ( groups ) do if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( v[1] ) ) then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) outputChatBox ( v[2].. " "..RGBToHex(r,g,b) .. getPlayerName ( source ) .. ":#FFFFFF " .. msg, getRootElement(),255,255,255, true ) break end end end end ) EDIT: If you see 2 outputs then that means play or freeroam is running.
  14. You must close your server before editing acl + set it to false in default and set it to true for groups you want.
  15. Saml1er

    getPlayerIP

    Can you show use the main code where you are calling those functions?
  16. I was looking for this. Thank you so much.
  17. Hello Peeps! When you enter a hunter vehicle then it takes some time to start flying it but in race resource when player is warped in hunter vehicle then he can fly hunter without any delay. I searched whole race resource but didn't find anything for this problem. Does anyone know how to solve this?
  18. You can modify my code. local sx,sy = guiGetScreenSize() addEventHandler("onClientRender",root, function () if isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) if veh and isElement(veh) then local ch,tw = getElementHealth(veh)-250, sx*(170/1920) local ch = ch / 750 * 100 dxDrawRectangle(sx*(844/1920), sy*(10/1080), tw, sy*(24/1080), tocolor(0, 0, 0, 150), true) if ch >= 0 then ------------------------- HEALTH ------------------------- dxDrawRectangle(sx*(844/1920), sy*(10/1080), ch*tw/100, sy*(24/1080), tocolor(0, 0, 0, 255), true) end end end end )
  19. First you must get the player's account using getPlayerAccount and then use getAccountName local ranp = getRandomPlayer() if ranp then local acc = getPlayerAccount (ranp ) local accName = getAccountName (acc) -- You got his account name else outputChatBox ("Could not find a random player") end
  20. Saml1er

    Local Chat

    Paste your meta.xml code here.
  21. Once an élément is attached to other élément then don't use setElementRotation. Use this: setElementAttachedOffsets
  22. Yes, accessing local variables/functions is faster than global.
  23. local t_button = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) guiSetVisible ( t_button, false ) --- No point for this function if this is set to true addEventHandler ( "onClientClick", getRootElement(), function ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if button == "left" and state == "up" and clickedElement then if getElementType( clickedElement ) ~= "ped" then return end guiSetVisible ( t_button, true ) end end )
×
×
  • Create New...