Jump to content

sanyisasha

Members
  • Posts

    65
  • Joined

  • Last visited

Everything posted by sanyisasha

  1. I found a not best, but looks like working solution. I made a bridge shared file. Created a shared variable: Class_test -- user.s.lua test = class() function test:__init(initial) -- constructor self.balance = initial or 0 end function test:deposit(amount) self.balance = self.balance + amount end function test:getBalance() return self.balance end Class_test = test In user.s.lua, in the last row writed this: Class_test = test In app.s.lua, writed this: local t = Class_test(10) Then: outputDebugString(t:getBalance()) <- in console: 10. Thanks everyone!!
  2. [redacted] Here you can find tons of RP gamemodes It's hungarian language, but better then owl mod (Btw you can find the 2016 Owl gaming mod in it)
  3. You need an eventHandler, called onPlayerWasted. When itt calls, first half the money. You can do it by local halfMoney = getPlayerMoney(player)/2 setPlayerMoney(player,halfMoney) Then make an object to the player position by: local x,y,z = getElementPosition(player) local moneyPickup = createPickup(x,y,z,3,1212) setElementData(moneyPickup, 'halfMoney', halfMoney) And then, you can call another event where you handle the pickup: addEventHandler('onPickupHit',moneyPickup,function(player) local halfMoney = getElementData(source, 'halfMoney') givePlayerMoney(player,halfMoney) destroyElement(source) end) And if someone pickups it, destroy the pickup. Another method is create simple object, and on player hit the object destroy it.
  4. That's okey. But. How i'll separate these in two lua files? Example: models/user.s.lua <-- Create class named User app.s.lua <-- instantiates User class from models/user.s.lua My solution was every model had a function called get<ModelName>Model, what return the needed class. It worked well, if i had a User.name, i was able to print it. But if i tryed to call User.setname(newname), it writed the setname function is nill.
  5. That's okey. But! If i'll send this to another script, i'll get 'error': Class:doStuff value will equal to nill! That's my problem, not the OOP
  6. Re upload the image, it's gone. MrTasty is right, we can help where you can start, but can't help to code it for you. Good luck, SaSha.
  7. Didn't read all the comments but: local r,g,b = 255, 255, 255 if getPlayerTeam(player) then if getTeamColor(getPlayerTeam(player)) then r,g,b = getTeamColor(getPlayerTeam(player)) end end With this you don't get error if team's color didn't set.
  8. What is Omegausergroup and Xyruviausergroup?
  9. I think load time not rly matter. In a finished server, you won't restarting the server's scripts, so... But the real anwser: technically yes, load it faster.
  10. Let's go though: Open a shop panel, buy sometring. Yes, it's simple with gui. Restrictted by acl group. Why? If you want to make an ACL like settings 'script', make an XML. Appear in ACL group. Yes, it's possible to. Use this: https://wiki.multitheftauto.com/wiki/AclGroupAddObject I hope it will help. Your project is possible, but not recommended. Better if you use arrays, xml files or database. Good luck, SaSha.
  11. On client side (mainly) use this on start, render or where ever you want: function hideRadarHudAndChat() setPlayerHudComponentVisible('all', false) -- Enable all what you want, example: setPlayerHudComponentVisible('crosshair', true) -- And hide chat with: showChat(false) end Good luck, SaSha
  12. You can make it in two ways. The first way is double triggering. You should trigger a getPlayerCountServer, and then retrigger a recrivePlayerCountClient in clientside. The secound what is not 100% to work, make a shared script, in it make a playerCount variable. In server, set playerCount equar to getPlayerCount. If i'm right, if you change playerCount shared variable in serverside, you shold see it in client side, but i'm not 100%. Good luck, SaSha.
  13. It's not possible to animate object. Only possible way as Keiichi1 said: bool moveObject ( object theObject, int time, float targetx, float targety, float targetz, [ float moverx, float movery, float moverz, string strEasingType, float fEasingPeriod, float fEasingAmplitude, float fEasingOvershoot ] ) In later versions, you may able to animate Peds. In (maybe) 1.5.6 there is a function called ifp engineLoadIFP ( string ifp_file / string raw_data, string CustomBlockName ) where you can include IFP, and then use it with bool setPedAnimation ( ped thePed [, string block=nil, string anim=nil, int time=-1, bool loop=true, bool updatePosition=true, bool interruptable=true, bool freezeLastFrame=true, int blendTime=250] ) Good luck
  14. Hi. Somehow possible to make a custom class (like Vehicle) and add custom function to it (e.g. Vehicle:create(...)) I want to create a class based system, where i make base classes (e.g User), then make custom functions (e.g User:setMoney(100)) My main problem is, as i saw in mta it's not possible to export function as variable/element data value. I don't want to make it like: exports.resource:User_setMoney(UserClass, 100), but it should called like before, User:setMoney(100), because that's why i want to make the system: make mta programing easier with a cool framework (Like in PHP -> Yii2, Laravel) Any possibility to make it work? Thanks, SaSha
  15. Hello. How can i post in wiki to "useful" functions? I have some script, what not in the wiki, but it's very simple and nice.
  16. sanyisasha

    Map blips

    Hello, i want to create a map to my dashboard, but i can't fix the blips positions. It's not a full map, only an image section. https://scontent-vie1-1.xx.fbcdn.net/hphotos-xpt1/v/t35.0-12/12449235_1666821136931378_230067199_o.jpg?oh=268ab8d7d37b3aecd9ce28355e7b51d0&oe=5681CBCD In this image you can see the blue dott. And it's not in good position. Here the real: https://scontent-vie1-1.xx.fbcdn.net/hphotos-xat1/v/t35.0-12/12422245_1666657106947781_2105292589_o.jpg?oh=e9ec043976e6e950fcb6649649428a57&oe=5680D048 (Here only the white blip, that's the real position) My algorithms: local worldX, worldY = getElementPosition(elem) x = ((3000 + worldX) * (box[1] / 6000) - m_startx)*m_zoom y = ((3000 - worldY) * (box[2] / 6000) - m_starty)*m_zoom --box[1 and 2]: the map actual shoved size(In first image what you can see, the "box" size) --m_startx/m_starty: image section start x,y --m_zoom: actual zoom. (In default: 1) Thanks if you can help ^^ SaSha
  17. string.match or gsub. But try not use math in string. Example: 3+1 a = 3 b = 1 func = "plus" if func == plus then c = 3 + 1 end outputChatBox(a.." + "..b.." = "..c)
  18. Try search for the forum encryption. For example smf i mean use SH256. The secound problem: Don't cross ACL and MySQL. You use addAccount (ACL) and dbConnect(MySQL). Try use Elements. Like: setElementData(player,"username","sasha"). Learn more about this: https://wiki.multitheftauto.com/wiki/Element/Player And: https://wiki.multitheftauto.com/wiki/SetElementData If you need more help, maybe search me on facebook: https://www.facebook.com/SanyiSasha
  19. Hello guys. I have a problem with gui and click event. So: I want to make a chat system, and it's have a "tab" section, where the players can switch the rooms. My problem is, if i push "t" button, the chat opening, but if i click anywhere, no action. But if i before "t" push, push "m" (showCursor function) all works fine. How can i fix it? addEventHandler("onClientClick",root,changeSelected) local chatInputBox = guiCreateEdit(x,y,w,h,"",false) function changeSelected(button,state) --Where i add onClientClick, i have a "isInBox" function. if button == "left" and state == "down" then Chat.selected = 2 end end
  20. Image not found. Can you send it again?
  21. Edit: Replace the movestate to the getPlayerIdleTime.
×
×
  • Create New...