Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. As I told you before, you need to use either dxDrawText or the text lib which is already on race resource combined with triggerClientEvent.
  2. You can't change the font of that text.
  3. local jobmarker = createMarker ( 1192.25390625, -1324.5009765625, 13.3984375, "cylinder", 1.0, 0, 255, 255, 50 ) local x,y = guiGetScreenSize() -- Get players resolution. function renderRectangle() dxDrawRectangle(226.0,97.0,387.0,402.0,tocolor(255,255,255,255),false) end function jobmarkerHit () addEventHandler("onClientRender",root,renderRectangle) outputChatBox("This is a test message", 255, 153, 0) outputChatBox("This is a second test message", 255, 153, 0) end addEventHandler( "onClientMarkerHit", jobmarker, jobmarkerHit ) function jobmarkerLeave () removeEventHandler("onClientRender",root,renderRectangle) end addEventHandler( "onClientMarkerLeave", jobmarker, jobmarkerLeave ) function useJob() if isElementWithinMarker(localPlayer, jobmarker) then if exports.global:hasMoney(localPlayer, 50) then exports.global:giveMoney(localPlayer, 50) outputChatBox("You have been given 50$ due to testing purposes.", 0, 255, 0) else outputChatBox("You are not at the right place!", 255, 0, 0) end end end addCommandHandler("job", useJob)
  4. DX drawing functions are client side only, and they also require 'onClientRender' event to render them. use: triggerClientEvent to add the event handler to render it.
  5. local jobmarker = createMarker ( 1192.25390625, -1324.5009765625, 13.3984375, "cylinder", 1.0, 0, 255, 255, 50 ) function jobmarkerFunction (thePlayer) outputChatBox("This is a test message", thePlayer, 255, 153, 0) outputChatBox("This is a second test message", thePlayer, 255, 153, 0) end addEventHandler( "onMarkerHit", jobmarker, jobmarkerFunction ) function useJob(thePlayer) if isElementWithinMarker(thePlayer, jobmarker) then if exports.global:hasMoney(thePlayer, 50) then exports.global:giveMoney(thePlayer, 50) outputChatBox("You have been given 50$ due to testing purposes.", thePlayer, 0, 255, 0) else outputChatBox("You are not at the right place!", thePlayer, 255, 0, 0) end end end addCommandHandler("job", useJob) First: You have used localPlayer in a server side script, when that function is only client side. Second: You are trying to add a event handler to a non existing function. Third: You're using the argument 'player' in 'useJob' function but your player argument is 'thePlayer'
  6. You can't do that, you can only change the color and the text of the message. To change font and add stroke and so on, you'll need to trigger a event to the client side to create the text.
  7. Done, uploaded a update. Change log: Added settings for: scoreboard column name, gang panel bind, gangs list command, create gang command. Added a new exported function: isGangSubLeader (gangName, accountName).
  8. That's just a example code, change the: x, y, z coordinates to a new position.
  9. function spawnSlothBot(thePlayer, cmd, skin, weapon, mode, rot, team) local x, y, z = getElementPosition (thePlayer) local rot = tonumber(rot) or 0 local team = getTeamFromName(team) local int = getElementInterior(thePlayer) local dim = getElementDimension(thePlayer) local weapon = tonumber(weapon) or 0 local skin = tonumber(skin) or 0 exports["slothbot"]:spawnBot( x, y+1, z, rot, skin, int, dim, team, weapon, mode or "hunting", true ) end addCommandHandler ( "spawnbot", spawnSlothBot )
  10. Maybe the font is wrong? or too big?
  11. kimmis: The script uses SQLITE, not MySQL . Anyway, I don't see what's the problem with compiling it, it works perfect, it has exported functions to manage it from another scripts and so on. Now, if you guys could stop complaining about it.
  12. addEventHandler("onClientResourceStart",resourceRoot, function () myFont = guiCreateFont( "font/20.ttf", 12 ) end ) addEvent("Enter",true) addEventHandler("Enter",getRootElement(), function(name) if isElement(jon) and isElement(p_name) then restTimer(pn) restTimer(jn) guiSetText(p_name,tostring(name)) else jon = guiCreateLabel(14,197,38,14," Joined: ",false) guiSetFont( jon, myFont ) p_name = guiCreateLabel(59, 198, 227, 17,tostring(name),false) pn = setTimer(destroyElement,22000,1,p_name) jn = setTimer(destroyElement,22000,1,jon) end end )
  13. https://wiki.multitheftauto.com/wiki/Slothman/Slothbot
  14. Well, I've seen many servers with my "c-panel" resource with someone else credits.
  15. That script should bind the key's when a player logs in, or do you want it to bind them when the resource starts? if so: -- client side: function bindTheKeys() bindKey("Q", "down", openMenu) bindKey("Q", "up", closeMenu) bindKey("E", "down", startGoogle) bindKey("E", "up", stopGoogle) end addEventHandler("onClientResourceStart", resourceRoot, bindTheKeys) function openMenu() knife = guiCreateStaticImage(0.4678, 0.3242, 0.0977, 0.1315, "images/knife", true) sword = guiCreateStaticImage(0.5830, 0.4336, 0.0977, 0.1315, "images/sword", true) gun = guiCreateStaticImage(0.3457, 0.4479, 0.0977, 0.1315, "images/gun", true) fist = guiCreateStaticImage(0.4688, 0.5898, 0.0977, 0.1315, "images/fist", true) logo = guiCreateStaticImage(0.4521, 0.4232, 0.0977, 0.1315, "images/aclogo", true) guiSetVisible(not guiGetVisible(knife)) guiSetVisible(not guiGetVisible(sword)) guiSetVisible(not guiGetVisible(gun)) guiSetVisible(not guiGetVisible(fist)) guiSetVisible(not guiGetVisible(logo)) showCursor(not isCursorShowing()) end function closeMenu() guiSetVisible(not guiGetVisible(knife)) guiSetVisible(not guiGetVisible(sword)) guiSetVisible(not guiGetVisible(gun)) guiSetVisible(not guiGetVisible(fist)) guiSetVisible(not guiGetVisible(logo)) showCursor(not isCursorShowing()) end function giveTheWeapons(element) if (element == knife) then triggerServerEvent("giveKnife", localPlayer) elseif (element == sword) then triggerServerEvent("giveSword", localPlayer) elseif (element == gun) then triggerServerEvent("giveGun", localPlayer) elseif (element == fist) then triggerServerEvent("useFist", localPlayer) end end addEventHandler("onClientMouseEnter", getRootElement(), giveTheWeapons) function startGoogle() if (getCameraGoggleEffect == "normal") then setCameraGoggleEffect("thermalvision") end end function stopGoogle() if (getCameraGoogleEffect == "thermalvision") then setCameraGoogleEffect("normal") end end -- server side: function giveMyKnife() takeWeapon(source, 8 ) takeWeapon(source, 24) giveWeapon(source, 4, 1) end addEvent("giveKnife", true) addEventHandler("giveKnife", getRootElement(), giveMyKnife) function giveMySword() takeWeapon(source, 4) takeWeapon(source, 24) giveWeapon(source, 8, 1) end addEvent("giveSword", true) addEventHandler("giveSword", getRootElement(), giveMySword) function giveMyGun() takeWeapon(source, 8 ) takeWeapon(source, 4) giveWeapon(source, 24, 3) end addEvent("giveGun", true) addEventHandler("giveGun", getRootElement(), giveMyGun) function useMyFist() takeWeapon(source, 8 ) takeWeapon(source, 4) takeWeapon(source, 24) end addEvent("useFist", true) addEventHandler("useFist", getRootElement(), useMyFist)
  16. If that would be true, then many resources should have been removed, but as far as I know, we can upload compiled scripts if we want.
  17. -- client side: function bindTheKeys() bindKey("Q", "down", openMenu) bindKey("Q", "up", closeMenu) bindKey("E", "down", startGoogle) bindKey("E", "up", stopGoogle) end addEvent("onClientPlayerLogin",true) addEventHandler("onClientPlayerLogin", getRootElement(), bindTheKeys) function openMenu() knife = guiCreateStaticImage(0.4678, 0.3242, 0.0977, 0.1315, "images/knife", true) sword = guiCreateStaticImage(0.5830, 0.4336, 0.0977, 0.1315, "images/sword", true) gun = guiCreateStaticImage(0.3457, 0.4479, 0.0977, 0.1315, "images/gun", true) fist = guiCreateStaticImage(0.4688, 0.5898, 0.0977, 0.1315, "images/fist", true) logo = guiCreateStaticImage(0.4521, 0.4232, 0.0977, 0.1315, "images/aclogo", true) guiSetVisible(not guiGetVisible(knife)) guiSetVisible(not guiGetVisible(sword)) guiSetVisible(not guiGetVisible(gun)) guiSetVisible(not guiGetVisible(fist)) guiSetVisible(not guiGetVisible(logo)) showCursor(not isCursorShowing()) end function closeMenu() guiSetVisible(not guiGetVisible(knife)) guiSetVisible(not guiGetVisible(sword)) guiSetVisible(not guiGetVisible(gun)) guiSetVisible(not guiGetVisible(fist)) guiSetVisible(not guiGetVisible(logo)) showCursor(not isCursorShowing()) end function giveTheWeapons(element) if (element == knife) then triggerServerEvent("giveKnife", localPlayer) elseif (element == sword) then triggerServerEvent("giveSword", localPlayer) elseif (element == gun) then triggerServerEvent("giveGun", localPlayer) elseif (element == fist) then triggerServerEvent("useFist", localPlayer) end end addEventHandler("onClientMouseEnter", getRootElement(), giveTheWeapons) function startGoogle() if (getCameraGoggleEffect == "normal") then setCameraGoggleEffect("thermalvision") end end function stopGoogle() if (getCameraGoogleEffect == "thermalvision") then setCameraGoogleEffect("normal") end end -- server side: function giveMyKnife() takeWeapon(source, 8 ) takeWeapon(source, 24) giveWeapon(source, 4, 1) end addEvent("giveKnife", true) addEventHandler("giveKnife", getRootElement(), giveMyKnife) function giveMySword() takeWeapon(source, 4) takeWeapon(source, 24) giveWeapon(source, 8, 1) end addEvent("giveSword", true) addEventHandler("giveSword", getRootElement(), giveMySword) function giveMyGun() takeWeapon(source, 8 ) takeWeapon(source, 4) giveWeapon(source, 24, 3) end addEvent("giveGun", true) addEventHandler("giveGun", getRootElement(), giveMyGun) function useMyFist() takeWeapon(source, 8 ) takeWeapon(source, 4) takeWeapon(source, 24) end addEvent("useFist", true) addEventHandler("useFist", getRootElement(), useMyFist) addEventHandler("onPlayerLogin",root, function () triggerClientEvent(source,"onClientPlayerLogin",source) end )
  18. The only images I've used are: jpg, jpeg, png, bmp.
  19. What? your post makes no sense for me. "internal.db" is where accounts are saved and "registry.db" is where SQLITE functions save data.
  20. Because the resource is compiled to avoid removing credits.
  21. Estas usando el recurso "scores"? el que pone las kills y deaths en la scoreboard, si es asi, entonces podes usar: getElementData -- Para obtener las kills. getPlayerAccount -- Para obtener la cuenta del jugador al salir. setAccountData -- Para cambiar un dato de la cuenta. setElementData -- Para cambiar las kills del jugador al loguearse. onPlayerLogout -- Para guardar las kills al hacer logout. onPlayerQuit -- Para guardar las kills al salir del servidor. onPlayerLogin -- Para cargar las kills guardadas en la cuenta del jugador. Ahora con esas funciones y eventos tenes que averiguar como crear el script.
  22. What would be the problem on adding all the event handlers at once? I think it would be more efficient than having to loop every time.
  23. GUI and DX drawing (the functions to create interfaces) are all client side, the only thing you can do is use the server side text functions: https://wiki.multitheftauto.com/wiki/Ser ... _functions
  24. Castillo

    Peds :s

    Category: script Author: 50p - El autor. Downloads: 2217 Rate: Rating: 3.9 (48 Votes)
×
×
  • Create New...