-
Posts
1,423 -
Joined
-
Last visited
-
Days Won
19
Everything posted by Tekken
-
Try this, make sure you edit the table to whatever you like local TPLimit = 5000; local tpForLevel = { {5000, 1}, {10000, 2}, {15000, 3}, -- Add as many as you want! }; function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil; if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower(); if name_:find(name, 1, true) then return player; end end end end function givePlayerTP(thePlayer, tp) if (thePlayer) then if (tonumber(tp) > 0) then setElementData(thePlayer, "playertp", (getElementData(thePlayer, "playertp") or 0) + tp); for _,v in ipairs(tpForLevel) do if (v[1] >= getElementData(thePlayer, "playertp")) then setElementData(thePlayer, "playerlevel", v[2]); outputChatBox("level up", thePlayer); outputChatBox(getElementData(thePlayer, "playerlevel"), thePlayer); end end end end end function setPlayerTP(thePlayer, tp) if (thePlayer) then if (tonumber(tp) >= 0) then setElementData(thePlayer, "playertp", tp); for _,v in ipairs(tpForLevel) do if (v[1] >= getElementData(thePlayer, "playertp")) then setElementData(thePlayer, "playerlevel", v[2]); outputChatBox("level up", thePlayer); outputChatBox(getElementData(thePlayer, "playerlevel"), thePlayer); end end end end end function getPlayerTP(thePlayer) if (thePlayer) then return getElementData(thePlayer, "playertp") or 0; end end addCommandHandler("settp", function(playerSource, commandName, targetPlayer, tp) local target = getPlayerFromPartialName(targetPlayer); if not tonumber(tp) or not target then outputChatBox("/"..commandName.." [játékos] [pont]", playerSource); else if (tonumber(tp) >= 0) then setPlayerTP(target, tp); outputChatBox(getPlayerTP(target).." TP", target); else outputChatBox("0-nak vagy annál többnek kell lennie", playerSource); end end end); addCommandHandler("givetp", function(playerSource, commandName, targetPlayer, tp) local target = getPlayerFromPartialName(targetPlayer); if not tonumber(tp) or not target then outputChatBox("/"..commandName.." [játékos] [pont]", playerSource); else if (tonumber(tp) > 0) then givePlayerTP(target, tp); outputChatBox(getPlayerTP(target).." TP", target); else outputChatBox("többnek kell lennie mint 0", playerSource); end end end); addCommandHandler("gettp", function(playerSource) local points = getPlayerTP(playerSource); outputChatBox(points, playerSource); end);
-
Try this: local TPLimit = 5000; function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil; if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower(); if name_:find(name, 1, true) then return player; end end end end function givePlayerTP(thePlayer, tp) if (thePlayer) then if (tp > 0) then setElementData(thePlayer, "playertp", (getElementData(thePlayer, "playertp") or 0) + tp); if (getElementData(thePlayer, "playertp") > TPLimit) then --Level up. end end end end function getPlayerTP(thePlayer) if (thePlayer) then return getElementData(thePlayer, "playertp") or 0; end end function setPlayerTP(thePlayer, tp) if (thePlayer) then if (tp > 0) then setElementData(thePlayer, "playertp", tp); if (getElementData(thePlayer, "playertp") > TPLimit) then --Level up. end end end end addCommandHandler("givetp", function(playerSource, commandName, targetPlayer, tp) local target = getPlayerFromPartialName(targetPlayer); -- way better that the built in MTA function! if not tp or not target then outputChatBox("/" .. commandName .. " [játékos] [pont]", playerSource); else if (tonumber(tp) > 0) then givePlayerTP(target, tp); outputChatBox("" .. getPlayerTP(target) .. " TP", target); else outputChatBox("többnek kell lennie mint 0", playerSource); end end end); addCommandHandler("gettp", function(playerSource) local points = getPlayerTP(playerSource); outputChatBox("" .. points .. "", playerSource); end); Also you must save the TP when player quit and load it when join.
-
Just add a check like this: if (getElementData(player, "playertp") + tp >= TPlimit) then --The player has just level up. end You can create an event and trigger it when the player level's up.
-
Actually setElementData(player, "playertp", (getElementData(player, "playertp") or 0) + tp); Or you can use tables like this: Replace local playerTP = 0; playerTP = playerTP + tp; with local playerTP = {}; -- Create the table at the very top. playerTP[player] = playerTP[player] + tp; --Add [player] to make sure it's for the right player.
-
I don't like that idea so that's up to you, this is an open source project that means everyone can do whatever they want. I don't do requests unless I like them.
-
Any errors in the console? For skins you will have to use those functions engineLoadTXD() engineImportTXD() engineLoadDFF() engineReplaceModel() Before restarting the server delete the backup.db from "...dayz/tools/backup.db" that should fix the vehicle spawning problem.
-
For bobcat spawn in vehicles.lua in vehicleSpawns table add {422, x, y, z}, I won't explain you how to give zombies skins 'cause this is to easy, and you should know how to do it. To reduce the amount of zombies in core_client.lua you will find a timer at line 298 edit the below 5 to as much or low zombies as you want. if ((getElementData(getLocalPlayer(), "spawnedzombies")+1) <= 5) then
-
Yes it is, the attachments won't stay on the body. Yes it is, the attachments won't stay on the body.
-
Well thanks, that's what I was looking for. Well thanks, that's what I was looking for. Well thanks, that's what I was looking for.
-
But does this work with CJ skin?
-
As far as I can see your script is full of errors and warnings so you pretty much have to re-write it.
-
Hello community I have a question. Is it better to use predefined variables or functions? Like: localPlayer and getLocalPlayer() witch one will produce less lag?
-
I have a sentiment that this game will never die. There will not be another game like GTA SA. MTA brought me to scripting and along Lua I also learned PHP, MySQL, HTML, CSS, JavaScript and currently studying C++, thank you MTA Team and thank you MTA community.
- 24 replies
-
- 2
-
-
- press
- rockpapershotgun
-
(and 1 more)
Tagged with:
-
Yes making it working with MTA Account system will be great.
-
This Login Panel looks pretty nice, I haven't made one cause I don't like working with DX Functions.
-
I may, in the future when I end up all the things I started, but I need someone to help me with images for weapons and some other textures I am not good at all with making textures.
-
I wanted to do so, but I just realized I would've end up making the same thing so I decided to fix the old one and remodel it by my liking.
-
Can you show me the errors when you shoot someone? I will check about bloodbag and bandage, and the error from menu_client.lua
-
The local edit = createEdit(id, x, y, w, h, text, parent) Will return a string right? Can't you add a function like editGetText(edit) to get the text of the edit?
-
As far as I know Ransom has quit MTA, so...
-
De ce ar discuta cineva despre de ce nu-i porneste windows-ul pe forumurile MTA?
-
In caz ca nu ati observat pretul a fost pus pentru persoana nu pentru script. Stie el de ce.