
Metall
Members-
Posts
44 -
Joined
-
Last visited
Everything posted by Metall
-
I suggest to have colShapes instead of markers: createColCircle onColShapeHit onColShapeLeave
-
Here function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") local R = getAccountData (theCurrentAccount, "funmodev2-R") local G = getAccountData (theCurrentAccount, "funmodev2-G") local B = getAccountData (theCurrentAccount, "funmodev2-B") local playerX = getAccountData (theCurrentAccount, "funmodev2-x") local playerY = getAccountData (theCurrentAccount, "funmodev2-y") local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim) setPlayerMoney (source, playerMoney) setTimer (setElementHealth, 500, 1, source, playerHealth) setTimer (setPedArmor, 500, 1, source, playerArmor) setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted) setCameraTarget (source, source) fadeCamera(source, true, 2.0) setPlayerNametagColor (source, R, G, B) else spawnPlayer (source, 204.52904, 1861.50085, 13.14063, 0,78, 0, 0) setPlayerMoney (source, 100000) setCameraTarget (source, source) fadeCamera(source, true, 2.0) setPlayerNametagColor (source, 0, 255, 125) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", getRootElement(), onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then savePlayerWeapons(source) local x,y,z = getElementPosition (source) local r,g,b = getPlayerNametagColor (source) setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) setAccountData (account, "funmodev2-R", r) setAccountData (account, "funmodev2-G", g) setAccountData (account, "funmodev2-B", b) setAccountData (account, "funmodev2-x", x) setAccountData (account, "funmodev2-y", y) setAccountData (account, "funmodev2-z", z) setAccountData (account, "funmodev2-int", getElementInterior (source)) setAccountData (account, "funmodev2-dim", getElementDimension (source)) setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source)) end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then savePlayerWeapons(source) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 217.93694, 1853.37793, 12.79775, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) function onSpawn() if not( isGuestAccount (getPlayerAccount(source)) ) then loadPlayerWeapons(source) end end addEventHandler ("onPlayerSpawn", getRootElement(), onSpawn) function savePlayerWeapons(player) local account = getPlayerAccount(player) if isGuestAccount(account) then return end local weaponsString = "" for index = 0, 12 do local weapon = getPedWeapon(player, index) local ammo = getPedTotalAmmo(player, index) if ammo > 0 then weaponsString = weaponsString..";"..weapon..","..ammo end end setAccountData(account, "weapons", weaponsString) end function loadPlayerWeapons(player) local account = getPlayerAccount(player) if isGuestAccount(account) then return end local weaponsString = getAccountData(account, "weapons") takeAllWeapons(player) for index, wData in pairs(split(weaponsString, ";")) do local weapon, ammo = unpack(split(wData, ",")) weapon, ammo = tonumber(weapon), tonumber(ammo) if weapon and weapon ~= 0 and ammo and ammo ~= 0 then giveWeapon(player, weapon, ammo) end end end
-
local blipID = "number" local blipID2 = "number" function createBlipsOnStart() local blip1 = createBlip(blipID, x,y,z) local blip2 = createBlip(blipID2, x,y,z) end addEventHandler("onClientResourceStart", root, createBlipsOnStart)
-
function skinW(player) setElementModel(player, modelID) end addEventHandler("onPlayerSpawn", root, skinW) That's it? I didn't really understand your problem.
-
How to make and use exports Hello, and welcome to my tutorial, today i will be covering on how to use exports. An example for an export is: exports.RESname.functionName() I'm not experienced in exports, but the ones i'm covering should work properly, otherwise, some more experienced can fix them. So here we go: Begin by creating the actual export, inside a file, server or client. function isPlayerMetall(player) if(getPlayerFromName(player) == "Metall") then return true else return false end end Also, i dont use any handlers or anything, since this is our own check, awesome right? After that go to the actual meta file, and that's the actual export thingy dingy configuration obama dingy hingy. <meta> <export function="isPlayerMetall" type="client" /> <script src="client.lua" type="client" /> </meta> There is the thing. It reads a function, from a file, and checks what type it is "client" or "server". After that, you can use: exports.resname.isPlayerMetall() Not sure if this will work but: function test() if(exports.RESname.isPlayerMetall()) then -- do something else -- do something end end addCommandHandler("yo", test) Have fun in scripting!
-
Wrong, if i wasn't on a project, i would have been scripting for free.
-
Where is the bad argument then? Screenshot or text please
-
Well, i made this, and it worked.
-
Ofc, it's wrong, because objectID, won't give anything, this was an example, and in the tutorial i told to replace the objectID with an id.
-
Attaching objects tutorial, made by Metall Let's begin, well this tutorial covers how to attach objects to something, a vehicle for example. You can attach objects to a player too, which gives you the oppertunity to make urself a hamburger or whatever Well, here we go, i will make this tutorial like i will add 1 line, and explain it, much better for learning i hope Creating the actual function name, also including player, which is used for getting the player easier. function attachTest(player) Now let's get the X, Y, and Z of the player, by using this line: x,y,z = getElementPosition(player) Now, we'll add the actual object, we'll be using a local variable for it, the function will be: createObject. local object = createObject(objectID, x, y, z) Now let's get who's driving the actual car. local veh = getPedOccupiedVehicle(player) Now, what you all have been waiting for, attaching the object to the actual car, more about this under this line. attachElements(object, veh) The attachElements gets the object and or the player, it can also needs to have the variables in it, you cannot any other stuff there. Also, this thing does what it says, attaches the elements to together, like for now, the object to the car. Example: If you wan't to add it to the car do: local player = getLocalPlayer(player) attachElements(object, player) Let's continue on the main script, the object attaching the car. We have to end the function, by using this: "end" end Now let's add a command to add this object to your car: addCommandHandler("attachobject", attachTest) If you didn't get the code properly, then use this fully script already made: function attachTest(player) x,y,z = getElementPosition(player) local object = createObject(objectID, x, y, z) local veh = getPedOccupiedVehicle(player) attachElements(object, veh) end addCommandHandler("attachobject", attachTest) If you need any extra help or questions about attachElements, ask in a post down below. Goodluck in ur scripting, and don't hestate to ask me for help.
-
FROM VERSION 1.3.1 r4935 ONWARDS Which is this: http://code.google.com/p/mtasa-blue/sou ... ail?r=4935
-
When someone enter your server, they download all files, but does only save the client file, not meta or serverside. So, it's already protected, but if you wan't more protection use: fileDelete or a compiler.
-
Take a look at: http://www.mtamarket.com The owner is Castillo aka Solidsnake, who is a great scripter, have been scripting for years now. He's selling race scripts, and a turf system + car spawner and a job system for an affordable price, you could offer him special jobs to script for you, for a good price. Goodluck in finding a seller. EDIT: You could hire me as an scripter, for small scripts/help, but i'm not that experienced, but i know my round around what i do. Skype: tim.andersson81, write in the message bar that it's you or i won't accept you as contact.
-
A blip is a sort of small picture on the map, it shows mostly a location. Like a money blip looks like a dollar sign.. Read more about them on: http://www.wiki.multitheftauto.com/wiki/createBlip ^ That's the scripting function to create them, if you wan't id's + pictures they are there too.
-
if (getPlayerMoney(hitElement) >= 100) then Well, that checks if the player got less than 100$, you could change the "100" to whatever amount you wan't. And to place this in ur script, place it like this: addEventHandler("onMarkerHit", marker, function(hitElement) if (getElementType(hitElement) == "player") then if (getPlayerMoney(hitElement) >= 100) then setElementHealth(hitElement, 200 ) takePlayerMoney(hitElement, 1) outputChatBox( "you bought chicken", hitElement, 0, 255, 0 ) end end ) Under the 3rd line, so to say...
-
Here you got the meta.xml i think it works, not sure. <meta> <file src="sound.mp3" /> </meta> One more example adding the script to this. <meta> <file src="sound.mp3" /> <script src="script.lua" type=server/client" /> </meta> You can add more of that file src and script src lines by just pasting them in same line order.
-
Hi i need help with my script, it isnt showing the GUI when i'm starting the script, and it's probably a fail in the code. Client: function createLoginWondow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true) X = 0.0825 Y = 0.2 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) guiSetVisible(wdwLogin, false) end addEventHandler("onClientResourceStart", getResourceElement(getThisResource()), function () createLoginWindow() outPutChatBox("Welcome to Limitless, please login.") if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else outputChatBox("An Error has occured, and the login GUI hasnt been created") end showCursor(true) guiSetInputEnabled(true) end ) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) function createLoginWindow() ... addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) function clientSubmitLogin(button,state) if button == "left" and state == "up" then local username = guiGetText(edtUser) local password = guiGetText(edtPass) if username and password then triggerServerEvent("submitLogin", getRootElement(), username, password) guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else outputChatBox("Please enter a username and password.") end end end server: function loginHandler(username,password) if username == "user" and password == "apple" then if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputChatBox("Welcome to My Server.", client) end else outputChatBox("Invalid username and password. Please re-connect and try again.",client) end end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler) meta: <meta> <script src="client.lua" type="client" /> <script src="server.lua" type="server" /> </meta> Regards Metall, Newbie Scripter.