Jump to content

Tekken

Helpers
  • Posts

    1,413
  • Joined

  • Last visited

  • Days Won

    19

Everything posted by Tekken

  1. Have you tried conformPedRotation = true https://wiki.multitheftauto.com/wiki/SetElementRotation not sure but worth giving a try
  2. function getPositionInfrontOfElement ( element , meters ) if not element or not isElement ( element ) then return false end if not meters then meters = 3 end local posX , posY , posZ = getElementPosition ( element ) local _ , _ , rotation = getElementRotation ( element ) posX = posX - math.sin ( math.rad ( rotation ) ) * meters posY = posY + math.cos ( math.rad ( rotation ) ) * meters return posX , posY , posZ end Use it like that: local fx, fy, fz = getPositionInfrontOfElement(player, 5); -- get the x,y,z positions 5 meters in front of player! createObject(OBJECTID, fx, fy, fz); Remember getPositionInfrontOfElement is a useful function so you will have to paste the code above in order to work!
  3. Have you seen my message?
  4. If you use attachElements you use the y pos ex. y+2
  5. When you trigger bp() function in your script ? To me it looks like you just pasted that function there but you don’t even call it at all! you have the onElementDataChange event to check whenever an elements data changed you should use that event to check whether the opexp have changed and then call the function to give potential reward. You may check my simple level system if you still don’t get it working, it’s in my signature. Good luck.
  6. What zombie script are you using ?
  7. Hi, for that you will need the following functions: bindKey createObject attachElements (maybe?) and you have to do it in server side to assure others will see it! Good luck, and if you need help we’re here!
  8. Hello, I’ve moved your topic to Resources section for best results, as the scripting section is for scripting related questions and not for script requests! Greetings.
  9. May I see the updated script? Correct form: function storerob(player commandName) -- define player in function! -- no need to create 50+ functions, everything can be done in the same function. local money = math.random(200000, 400000); outputChatBox(" ", root); outputChatBox("-----------------------------------------------------", root, 255, 0, 0); outputChatBox("[ALERT] Someone has breaked the Locker in Store !!", root, 255, 0, 0); outputChatBox("-----------------------------------------------------", root, 255, 0, 0); outputChatBox(" ", root); outputChatBox("Robbing the money ...", player, 0, 255, 0); outputChatBox(" ", player); outputChatBox("------------------------------------------------------", player, 0, 255, 0); outputChatBox("You got $"..money.." by robbing a Store !! ", player, 0, 255, 0); outputChatBox("------------------------------------------------------", player, 0, 255, 0); outputChatBox(" ", player); givePlayerMoney(player, money); end addCommandHandler("robstore", storerob);
  10. edit: moved the topic to scripting section for best results!
  11. Tekken

    chat

    Why doesn’t it work ? May I see how you implemented it?
  12. Most likely loope() and money2() player argument not passed through the function You will need to pass the player like this loope( player ) money2( player )
  13. Tekken

    chat

    Try: if not message or message == "" then --need to supply more info; end
  14. Maybe in map editor ?
  15. Hello, please use <> when positing codes! You can't use login() function on client side, you will have to add a server event and call it from client, here you have a simple example: Client.lua function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Account Panel", true) guiWindowSetMovable(wdwLogin, false) -- define new X and Y positions for the first label X = 0.0825 Y = 0.15 -- define new Width and Height values for the first label Width = 0.25 Height = 0.25 -- create the first label, note the final argument passed is 'wdwLogin' meaning the window -- we created above is the parent of this label (so all the position and size values are now relative to the position of that window) guiCreateLabel(X, Y, Width, Height, "First name", true, wdwLogin) -- alter the Y value, so the second label is slightly below the first Y = 0.35 guiCreateLabel(X, Y, Width, Height, "Last name", true, wdwLogin) Y = 0.55 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.15 Width = 0.5 Height = 0.15 edtFirst = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.35 edtLast = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.55 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) -- set the maximum character length for the username and password fields to 50 guiEditSetMaxLength(edtFirst, 50) guiEditSetMaxLength(edtLast, 50) guiEditSetMaxLength(edtPass, 50) X = 0.0825 Y = 0.8 Width = 0.25 Height = 0.25 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) X = 0.415 btnRegister = guiCreateButton(X, Y, Width, Height, "Register", true, wdwLogin) guiSetVisible(wdwLogin, false) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false); addEventHandler("onClientGUIClick", btnRegister, clientSubmitRegister, false); end addEventHandler("onClientResourceStart", resourceRoot, function() createLoginWindow(); guiSetVisible(wdwLogin, true); showCursor(true); guiSetInputEnabled(true); end); function clientSubmitLogin(button, state) if button == "left" and state == "up" then local firstName = guiGetText(edtFirst); local lastName = guiGetText(edtLast); local username = firsName .. "_" .. secondName; local password = guiGetText(edtPass); --print(player .. username .. password); if username and password then triggerServerEvent("customLoginPlayer", localPlayer, username, password); end guiSetInputEnabled(false); guiSetVisible(wdwLogin, false); showCursor(false); end end function clientSubmitRegister(button, state) if button == "left" and state == "up" then local firstName = guiGetText(edtFirst); local lastName = guiGetText(edtLast); local username = firsName .. "_" .. secondName; local password = guiGetText(edtPass); --print(player .. username .. password); if username and password then triggerServerEvent("customLoginPlayer", localPlayer, username, password); end guiSetInputEnabled(false); guiSetVisible(wdwLogin, false); showCursor(false); end end Server.lua addEvent("customLoginPlayer", true); addEventHandler("customLoginPlayer", root, function(username, password) local account = getAccount(username, password); if not account then outputChatBox("No account found, please check credentials!"); else logIn(client, account, password); outputChatBox("You got logged in, woha!"); end end); addEvent("customRegisterPlayer", true); addEventHandler("customRegisterPlayer", root, function(username, password) if not getAccount(username) then local theAccount = addAccount(username, password); if theAccount then logIn(client, theAccount, password); outputChatBox("You got logged in, woha!"); end else outputChatBox("Oupss, there is already an account with this username!"); end end); Keep in mind this resource have to have admin rights! Hope that help you out!
  16. The problem is that he as a server owner wants to load a custom carmods.dat file so this way will not work.
  17. Hi Nope, don’t think so, however MTA supports a lot of handling modifications and custom tuning to vehicles if that’s what you looking for. https://wiki.multitheftauto.com/wiki/AddVehicleUpgrade Greetings.
  18. There you go: good luck
  19. Moved your topic to Portuguese language for best results!
  20. It will not be as you freeze it on client side (the PC of the player that frozen the object), so you should do it on server side: testdoor = createObject(1499, 1580.03149, -1631.73987, 12.38281) function freezeObject() local currentFreezeStatus = isElementFrozen ( testdoor ) if currentFreezeStatus then setElementFrozen ( testdoor, not currentFreezeStatus ) outputChatBox("You have opened the door!",255,255,255) else setElementFrozen ( testdoor, not currentFreezeStatus ) outputChatBox("You have closed the door!",255,255,255) end end addEventHandler("onResourceStart", resourceRoot, function() --bind for all online players on resource start for i,player in pairs(getElementsByType("player")) do bindKey(player, "e", "down", freezeObject) end end); addEventHandler("onPlayerJoin", root, function() --bind for player on he joins bindKey(source, "e", "down", freezeObject) end); Server-side^ Sorry for the messy code I’m on phone
  21. Server id off due to missing player interest, however I’m still working on a Standalone-like version, with real zombie threat, hard-survival, main objective will be to survive and not to kill other players. Will post some ss soon.
  22. Hello Can you point witch line is giving that error? Also a /debugscript 3 image will be much appreciated. Greetings!
  23. Tekken

    help please

    I've made you an simple AFK system based on your code: --Client local lasTimeOnKeyboard = getTickCount(); local timeoutAFK = 5; --How much minutes to make him AFK ? local isClientAFK = false; function toggleClientAFK(toggle) if isClientAFK ~= toggle then isClientAFK = toggle; triggerServerEvent("toggleAFKStat", localPlayer, toggle); end end addEventHandler("onClientRender", root, function() if (getTickCount() - lasTimeOnKeyboard) >= (timeoutAFK * 60000) then if not isClientAFK and getElementHealth(localPlayer) > 0 then toggleClientAFK(true); end end end); addEventHandler("onClientKey", root, function() lasTimeOnKeyboard = getTickCount(); toggleClientAFK(false); end); addEventHandler("onClientCursorMove", root, function() lasTimeOnKeyboard = getTickCount(); toggleClientAFK(false); end) addEventHandler("onClientRestore", root, function() lasTimeOnKeyboard = getTickCount(); toggleClientAFK(false); end) addEventHandler("onClientMinimize", root, function() toggleClientAFK(true); end); --Server addEvent("toggleAFKStat", true); local isPlayerAFK = {}; addEventHandler("toggleAFKStat", root, function(toggle) if toggle then if not isPlayerAFK[client] then isPlayerAFK[client] = true; outputChatBox(getPlayerName(client).." is now AFK!", root, 255, 0, 0, true); end else if isPlayerAFK[client] then isPlayerAFK[client] = false; outputChatBox(getPlayerName(client).." is no more AFK!", root, 0, 255, 0, true); end end end); NOTE that it contains both Client and Server! And BTW you can't use outputChatBox on client to output on root element!
  24. setElementModel (thePlayer, tonumber(getElementData(accSys:getPlayerAcc(thePlayer), "cSkin")))
×
×
  • Create New...