Dealman
Members-
Posts
1,421 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Dealman
-
I highly suggest you read a few tutorials about how scripting works. You have a ton of errors in your code. This should work; function getPlayerFromNamePart(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 warnPlayer_CMD(thePlayer, theCMD, theTarget, ...) if(theTarget ~= nil) then local theTargetElement = getPlayerFromNamePart(theTarget) if(getElementType(theTargetElement) == "player") then local allArgs = {...} local theReason = table.concat(allArgs, " ") outputChatBox("[WARN]: "..getPlayerName(thePlayer).."#FF0000 has warned "..getPlayerName(theTargetElement).."#FF0000!", getRootElement(), 255, 0, 0, true) outputChatBox("[WARN]: Reason: #FF2626("..tostring(theReason)..")", getRootElement(), 255, 0, 0, true) else outputChatBox("[WARN]: Invalid target! Syntax: /warn [Player] [Reason]", thePlayer, 255, 0, 0, true) end end end addCommandHandler("warn", warnPlayer_CMD, false)
-
Where are you defining the variable amountJailed? As far as I can tell, you're not defining it. Thus, it defaults to nil. Thus, it returns nil.
-
Sorry for the delay, I re-worked your code a bit. Make sure you read it thoroughly and look for comments I added where I made some bigger changes instead of simply pasting it - that way, you'll learn faster! Client-Side: Server-Side; Also, do note that I have not tested this code whatsoever. Mistakes and typos might happen. However, you should be able to go from here. Edit: As for setting account data, it's really simple! For example, if a data has not been set for the specified key already, it will return false. You can do something like this; Server-Side; (Account Data is always server-side, the data is also permanent. Data used using element data - is not.)
-
Ah, I see. You'll probably want to use setAccountData if you wanna save their total amount of arrests, kind of like statistics. Right? Then use getAccountData to get their score. About the money, I'd have to see how you trigger the event "takegive".
-
If you used absolute positions, you can divide the absolute value with your resolution - and then multiply it with the currently used one. For example; (Using 1360x768) local screenX, screenY = guiGetScreenSize() local exampleWindow = guiCreateWindow(screenX*(400/1360), screenY*(600/768), screenX*(150/1360), screenY*(300/768), "Example", true) In some cases it might not yield the result you want, and more complicated calculations might be needed. However, I have always used this method and it has always satisfied my needs so far.
-
I perfectly understood your question, but you don't seem willing to even learn how to navigate the Wiki - which has each and every function and event you'll need. So I don't even see any reason to help you with that attitude, have fun waiting for someone else to assist you.
-
One of the most important aspects of scripting for MTA is to learn how to navigate the Wiki. Ask yourself what you want to do, take notes - think about what you'll need, write down keywords. This is a great way to learn how to navigate the wiki. For example; • Command • Pickup (Bribe) • GUI • Wanted With those 4 keywords, you'll find the most basic functions you need to get going. As for events, ask yourself things like this; 1. You want interaction whenever a pickup is picked up. 2. Go to Client Events, search for the keyword above - "Pickup". 3. You'll get a few results, one of them being onClientPickupHit. 4. Read about this event. "This event triggers whenever a pickup is hit clientside." 5. Perfect, exactly what you need! Now you'll have the bare minimum stuff, finding the appropriate functions for the actual logic behind the script won't be as easy. But you'll never learn unless you give it a thorough try. Learn how to navigate the Wiki, and understand the examples. Then you'll be able to make pretty much anything your heart may desire.
-
You can use table.insert and table.remove to store/remove arrested players in a table. Then just count the entires inside that table to see how many players are arrested. @Money; You're not retrieving any data, thus the function does not know what to do. I don't know how you trigger it, but you'll need to do something like this; triggerEvent("takegive", getRootElement(), theGiver, theReceiver, theAmount) function givemoney(theGiver, theReceiver, theAmount) givePlayerMoney(theGiver, theAmount) takePlayerMoney(theReceiver, theAmount) end addEvent("takegive", true) addEventHandler("takegive", root, givemoney)
-
As mentioned before, attaching a ped would work. I wrote a very, very basic example. You can download it here. This isn't meant for actual use, and only a proof-of-concept and how you could do it. It's not perfect since the ped is in the center of the vehicle, triggering the event via hitting the rear will prove difficult. Also, I didn't test it on bigger vehicles. To Use; 1. Start the resource and type /create. 2. This will create a vehicle with a ped attached to it. 3. Shoot it with your water cannon, and the vehicle's alpha will change. Using the event "onVehicleHitByWaterCannon" server-side. This returns 2 elements, the vehicle that shot the cannon - and the vehicle that got hit. I also added code for it to attach peds to a vehicle whenever a player enters one - and store it in a table. You can use this server-side table to kill peds at will.
-
I think either you guys are misunderstanding him, or I am. As it stands, there is no current way of putting out the fire. Yes, you can cancel the event and prevent the player from taking damage - but that doesn't put the fire out. And of course you can make it so the water actually repairs the vehicles.
-
I know how to detect if a car is one fire since I have disabled vehicles in my gamemode from taking damage from it. However, as far as I'm aware - there is no way to tell MTA to put out a fire on a car. At least not as of now.
-
I'm pretty sure that as of now, you can't. Only workaround I can think of would be to use offsets using the vehicle as an point of origin. Then perhaps attach a very small object as the tip, which you can use as a bone. Alternatively, I know there is a script that lets you attach elements to bones of peds. I've never used this, but maybe that might work for vehicles as well?
-
Only guiSetVisible needs a boolean argument, guiGetVisible doesn't. It only needs the GUI element. The if statement should be written like this; if(guiGetVisible(Phone_Image) == true) then
-
Try something like this; (Untested);
-
I believe it would be more efficient to just have a server-side text file for it, rather than having to pull it from the database. That said, there are more than one way to accomplish what he wants. I simply put out one way of doing it, and the way I would have done it.
-
Then help him instead of mocking him. You did nothing other than make yourself look like a jerk just now.
-
Ah, I get it now. Then if I were you, I'd probably use the File functions; fileCreate -- Create a file, for example GangInfo.txt fileOpen -- Open it fileWrite -- Write the text to it fileClose -- Close the file (This automatically saves it) fileRead -- Use this to read the file, and put the text into the memo. (Needs fileOpen)
-
Could you try to be a bit more detailed? I am greatly confused as to what you're trying to do here
-
You'll need to use an event such as onPlayerDamage. You then check what kind of weapon was used, if the weapon was ID 14 - then get the source's health using getElementHealth, then use setElementHealth. Something like this. (Server-Side, Untested);
-
Deepu, not to be rude - but I honestly can't tell whether you're being serious or trolling. First of all, your prices are outrageous. You provide no type of screenshots so people can see an approximate of your capabilities. Second, from what I've seen and from what kind of questions you've been asking on the forums - I personally, in all honesty do not think that you are capable of what you're claiming to. Third, you mentioned "compilation of fun scripts" and "if you want seperate scripts you can ask me via skype". Why not just list them? If you're only willing to show them on Skype, I'd get the assumption that you're using either leaked scripts or custom scripts heavily based on leaked scripts. Fourth, buyers won't care whether it's a big necessity for you or not. They care about the price, and what kind of work they would get for that price. Fifth, I don't get why you're always trying to prove your knowledge. In almost each and every one of your threads you've got into fights with someone, where you're trying to prove that you're a professional programmer - instead of just being appreciative of the help received. All in all, I wouldn't recommend anyone to buy anything from you anywhere near those prices. Even at $10-$20 I'd hesitate. At least show your work, if you can't show it publicly - I don't see why anyone would bother buying anything from you. Since it looks very shady. PS. Good luck learning C, and making websites with it. You might want to do a bit of research regarding website design.
-
getVehicleComponentPosition is not bugged. Also, shouldn't you be using getVehicleComponentRotation if you wanna get the facing of the turret?
-
attempt to perform arithmetic on a boolean value
Dealman replied to vn007322815's topic in Scripting
Always read about the functions thoroughly. If you had, you'd of seen this; Just convert it to a number. -
Only some internet radios support 'dynamic' metas. Such as current artist and song, so don't expect each and every one to have it. Most "professional" ones have, though. You'll just have to try your way to see what radios use them or not. You do not need any API, only getSoundMetaTags.
-
Not sure what you're asking for, but you could take a look at the code of my internet radio, link's in the signature.
-
It really depends on what you're gonna do using those events.
