
DutchCaffeine
Members-
Posts
208 -
Joined
-
Last visited
Everything posted by DutchCaffeine
-
In the event onPlayerJoin you use the variable player, that variable aint exists. Use source. The same gous for onPlayerQuit! https://wiki.multitheftauto.com/index.ph ... PlayerJoin https://wiki.multitheftauto.com/index.ph ... PlayerQuit Some very important pages on the wiki: https://wiki.multitheftauto.com/index.ph ... =Main_Page https://wiki.multitheftauto.com/index.ph ... _Functions https://wiki.multitheftauto.com/index.ph ... ing_Events https://wiki.multitheftauto.com/index.ph ... _Functions https://wiki.multitheftauto.com/index.ph ... ing_Events Your code is very good explained on the wiki, please first search stuff on the wiki, and then if it wont work, ask here
-
I got something better. Put this on top of your script: -- Rewrite the function givePlayerMoney; _givePlayerMoney = givePlayerMoney; function givePlayerMoney(player, ammount) _givePlayerMoney(player, ammount); setElementData(player, "Money", getPlayerMoney(player)); end -- Rewrite the function takePlayerMoney; _takePlayerMoney = takePlayerMoney; function takePlayerMoney(player, ammount) _takePlayerMoney(player, ammount); setElementData(player, "Money", getPlayerMoney(player)); end -- Rewrite the function setPlayerMoney; _setPlayerMoney = setPlayerMoney; function setPlayerMoney(player, ammount) _setPlayerMoney(player, ammount); setElementData(player, "Money", getPlayerMoney(player)); end -- Usage function playerIsDead() takePlayerMoney(source, 500); outputChatBox("Doctor: You ain't got insurance, so i took the hospital bill from you!"); -- Ooopsie made a mistake, i needed to close with " and not with '. end addEventHandler("onPlayerWasted", getRootElement(), playerIsDead); Now it ain't that difficult anymore!!!! Good luck with it.
-
Here, i got something, something great, and works the way you want (with a bit of work) magic click Good luck with it. And o yes, that resource you showed, you can use it as every other resource, add in you gamemode meta.xml file:
-
[Outdated] Unofficial MTA Script Editor 0.3 (4851) RELEASED!
DutchCaffeine replied to 50p's topic in Scripting
It is nice to choice now your own server path. But there are a couple of things that are recommended to add: 1. Choise font style, i love to work with Courier new, size 8pt. 2. Edit the resource meta.xml. 3. Improve creating new files. Maybe something like in visual studio (2008) 4. Uhm, what is four, ow yes scan the lua files for functions, and add them also to autocomplete. (i know that it is posible). Keep up the fine work, and o yes is it a great idea to make it open source? Alexander -
I give an example about the seccond argument 'cmd': -- make the function function moneyCmd(player, cmd, ammount) if cmd == "giveMoney" then if ammount ~= nil then ammount = tonumber(ammount); givePlayerMoney(player, ammount); else outputChatBox("[usage] /givemoney [ammount]", player); end else if cmd == "takeMoney" then if ammount ~= nil then ammount = tonumber(ammount); takePlayerMoney(player, ammount); else outputChatBox("[usage] /takemoney [ammount]", player); end end end addCommandHandler("givemoney", moneyCmd); addCommandHandler("takemoney", moneyCmd); Thats how to use the seccond argument, you can assign multiple commands to a functions. And you can see wich command they use with the seccond argument.
-
Uhm, there is a mistake here: The variable sender is a player element, and you can not put it into a string. And the variable sendto is also wrong, cuz there need to be cmd. A better example of the code above: -- wiki says: player playerSource, string commandName, [string arg1, string arg2, ...] -- After commandName you can put the arguments of the command. In this case the name you want to sent to and a message function personalMessage(sender, cmd, sendTo, message) -- You see that there are in total 4 arguments needed in other to make the command work. -- Now we get the recpient recipient = getPlayerFromName(sendTo); -- Now we get the player name of the sender senderName = getPlayerName(sender); -- Now we are going to output the message into the chatbox outputChatBox("pm from " .. senderName .. ": " .. message, recipient); -- Now this command is working. end -- Add the command handler, i guess you know how that works. addCommandHandler('pm', personalMessage); A full working pm command.
-
[Outdated] Unofficial MTA Script Editor 0.3 (4851) RELEASED!
DutchCaffeine replied to 50p's topic in Scripting
Go to microsoft and complain also about asp, they have the <% ... %> syntax, that is also not a valid xml syntax. -
That is very very good, here i got something else: Useful functions: https://wiki.multitheftauto.com/index.ph ... _Functions callClientFunction: https://wiki.multitheftauto.com/index.ph ... ntFunction callServerFunction: https://wiki.multitheftauto.com/index.ph ... erFunction
-
[Outdated] Unofficial MTA Script Editor 0.3 (4851) RELEASED!
DutchCaffeine replied to 50p's topic in Scripting
It is a real nice editor, but i missing so much things, importand things: 1. Change the font type. (My programming font is courier new, 5 pt) 2. I hate the resource browser, just put every file in there, every xml file, every lua file, plus the meta.xml file. 3. Changing the resource path to an other folder, i keep my local server on my D: harddisk (seccond one) cuz of windows uac. 4. There was some more, but i don't remember. Please add/change does things -
Hmm can you explain better, it runs by me like a charm. I going to rebuild the system later the day. Watch this topic...
-
Hello everybody, This is a small release, and the code can be better. This resource RPG Vehicle lights add just some extra's to an rpg server, the things what this resource can do is: Toggle the vehicle lights. Left and right indicator. Warning flashers Police flashers (only for goverment vehicles) Plans for version 1.1.0 Progress [] 0% - Fixing the bugs that are reported here. - Improving the code. Plans for version 1.2.0 Progress [] 0% - Fixing the bugs of version 1.1.0 (that are reported here) - Adding some extra stuff, like the vehicle engine, speedo meter. Plans for version 2.0.0 Progress [] 0% - Add a configuration ui. - Add a dashboard - Add some nice sound. Plans for version 2.1.0 Progress [] 0% - Fixing bugs of version 2.0.0 (that are reported here) The community link with the download and some extra explainations: https://community.multitheftauto.com/index.html?p ... ils&id=380
-
Im gonna have to update mine alot tho atleast so u can see the blinker in the daytime and to toggle it on and off so i can git rid of the command..but it works for now The mine allready works, and blings also and you can turn it on and off in daytime!!!! Only got some key probs with the flashers now (warning flashers)
-
I'm busy atm. with a resource that will contain this. And it will be better then the source you got! (And it will have some more options! But i don't tell them )
-
50p You right about that. It is a kind of stupid of me. But it will work now! Now up to version 2.0 and back on-topic
-
Don't make things without your head because one day you'll wake up with an unexpected baby next to you. Also, please post suggestions not the code because I'll probably won't use that code anyway. Maybe people will edit there file? So if you include it or not, i'll post the code, only for people who are interested! And i love baby's! So that aint a problem also. Anymore problems?
-
I don't need that sorry. But i havn't tested yet, but i saw it. My fault. Just created it without my head. I edit my message. And also if var = "value" then Wont work either that little mistake i got on two places
-
Hello all, I have a little modification for this: Open the file window_class.lua Find: (line: ~18) function Window:Create( x, y, width, height, text, relative ) Replace width: function Window:Create( x, y, width, height, text, relative ) if y == nil or y == false and relative == false then local scr = {guiGetScreenSize()}; if x == "centered" then x = (scr[0]/2)-(width/2); y = (scr[1]/2)-(height/2); elseif x == "top-center" then x = (scr[0]/2)-(width/2); y = 0; elseif x == " bottom-center" then x = (scr[0]/2)-(width/2); y = scr[1]-height; end end What this does, is easy: Centered window: Window:Create("centered", nil, 500, 300, "login to our server!", false); Window at the top of the screen centered: Window:Create("top-center", nil, 500, 60, "Some information here.", false); Window at the bottom of the screen centered: Window:Create("bottom-center", nil, 500, 60, "Some information here.", false); Offcourse you enter just the x and y values. Example: Window:Create(50, 100, 500, 300, "Title", false); Now it is easy to create a centered window. And you don't need to calculate it on your own. Alexander
-
Where is the variable 'next'? And put in all the for loops the next code: outputDebugString("Execuded for loop"); And do that allways in your code, it helps finding things you overlooked!
-
That is eisier then replacing a vehicle model. First take a look at: development.mtasa.com (in the menu: wiki) Allright, we are going to create a window with the width of 500 and the height of 300 (nice window ) local welcomeWnd = nil; function createWelcomeWindow() -- Get the client screen resolution. local scr = {guiGetScreenSize() }; -- Create the w and h variables (width, height) local w, h = 500, 300; -- Create the x and y variables, and we are going to center the window right here. Just watch and see. local x, y = (scr[1]/2)-(w/2), (scr[2]/2)-(h/2); -- Now we are going to create the window. (it will be centered in all resolutions.) welcomeWnd = guiCreateWindow(x, y, w, h, "The title", false); guiSetVisible(welcomeWnd, false); end -- Now add the event onClientResourceStart (when the client has downloaded all the files) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() createWelcomeWindow(); guiShowCursor(true) guiSetVisible(welcomeWnd, true); end); That was easy
-
First, please ask it on a better way. I don't understand a word of it! Here are some starting links for you: http://development.mtasa.com/ https://community.multitheftauto.com/ http://robhol.net/guide/basics/
-
Wich country you come from. (only crazy ppl like you talk like that.). And yes my english is better then you. But my english is not that good. And i'm working on it.
-
True. But mostly i use it to get a coordinate fast, to put something like a pickup or something there. And using the admin panel, you need a set of big brains to keep them in mind. And keep in mind that i'm to lazy to write it down.
-
First: Look better, https://forum.multitheftauto.com/viewtop ... es#p292010 Second: You may like to send you your map! (Speak better English, this is not understand able.). And no i don't going to convert mta maps. Use google. There is a converter somewhere Here is one: http://gtamap.delux-host.com/converter/
-
Your welcome. But please read my message again, there are a couple of questions.
-
O man, o man, o man ... uhm i write this whole command from scratch. End look to it and see the difference. addCommandHandler("savepos", function(player, cmd, txt) local fh = fileOpen("cords.txt"); if not fh then fh = fileCreate("cords.txt"); if not fh then -- Now it is wrong! We don't have any permissions to create a file... outputChatBox("I can't create the file 'cords.txt'. Please contact an administrator", player); outputServerLog("Can't create the file 'cords.txt'. Please check the folder rights."); -- Return void. To prevent other actions. return; end end local x, y, z = getElementPosition(player); local fString = "[" .. txt .. "]\n" .. tostring(x) .. ", " .. tostring(y) .. ", " .. tostring(z) .. "\n\n"; fileWrite(fh, fString); fileClose(fh); outputChatBox("Youre coordinates are succesfully saved!", player); end); Couple of questions: Why open a file before you start an function, and close the file when you are in the function? Why do you append a integer value to a string? Answer them please, and learn! Alexander Why? Do you got an good reasen for that? I also write all my saved positions to a txt file. If i want a map file i'll get my coords in the mta editor.