Fabio(GNR) Posted September 27, 2010 Share Posted September 27, 2010 Isvehicledamageproof, I don't know how to do that, i created a script with help from wiki to set it DamageProof, and i want a function that sets it to false if the player is out the vehicle for xx seconds, So how do make it something like isvehicledmageproof = true then??? Wiki is unfinished at that page. And Colors, idk but with everyscript i use my colors dont work code for ouputplayerchatbox: outputChatBox ( "Your car is now Damage-proof, Leaving vehicle will dis-able", source, 0, 255, 0 ) Code SETvehicledamageproof: function godcar (g_Me) local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then outputChatBox("You have to be in a vehicle for CAR-god-mode!!",source,255,0,0) else outputChatBox ( "Your car is now Damage-proof, Leaving vehicle will dis-able", source, 0, 255, 0 ) setVehicleDamageProof(vehicle, true) end end (yes i kinda copied it from wiki ) Thanks... Link to comment
dzek (varez) Posted September 27, 2010 Share Posted September 27, 2010 you can ask us thousands of questions, or finally learn basics of programming (not lua, programming in general) Link to comment
Fabio(GNR) Posted September 27, 2010 Author Share Posted September 27, 2010 you can ask us thousands of questions, or finally learn basics of programming (not lua, programming in general) Were's a link? or just on MTA wiki? Link to comment
MiniGoveya Posted September 27, 2010 Share Posted September 27, 2010 for outputChatBox try this: outputChatBox ( "#FFFFFFYour car is now Damage-proof, Leaving vehicle will dis-able", getRootElement(), 255, 255, 255, true ) And, moreover, can not tell you idk that Link to comment
dzek (varez) Posted September 27, 2010 Share Posted September 27, 2010 Were's a link? or just on MTA wiki? https://wiki.multitheftauto.com/wiki/Scr ... troduction and generally whole "Scripting" box on main page: https://wiki.multitheftauto.com/wiki/Main_Page Link to comment
Fabio(GNR) Posted September 27, 2010 Author Share Posted September 27, 2010 Were's a link? or just on MTA wiki? https://wiki.multitheftauto.com/wiki/Scr ... troduction and generally whole "Scripting" box on main page: https://wiki.multitheftauto.com/wiki/Main_Page Ok thanks, i searched on google and now im doing a random java programming tut, but i will the right one now And to MiniGoveya, i tried that but then with playersource but i'll try again maybe i mistyped something or did it wrong thanks EDIT: i'll read further tomorrow, im starting to get what variables are thanks!!! Link to comment
MiniGoveya Posted September 28, 2010 Share Posted September 28, 2010 Were's a link? or just on MTA wiki? https://wiki.multitheftauto.com/wiki/Scr ... troduction and generally whole "Scripting" box on main page: https://wiki.multitheftauto.com/wiki/Main_Page Ok thanks, i searched on google and now im doing a random java programming tut, but i will the right one now And to MiniGoveya, i tried that but then with playersource but i'll try again maybe i mistyped something or did it wrong thanks EDIT: i'll read further tomorrow, im starting to get what variables are thanks!!! If it's a comand use playerSource that always work outputChatBox ( "..getPlayerName( playerSource ).."Your car is now Damage-proof, Leaving vehicle will dis-able", getRootElement(), 255, 255, 255, true ) Link to comment
dzek (varez) Posted September 28, 2010 Share Posted September 28, 2010 i think outputChatBox IS NOT his problem.. but whatever Link to comment
Fabio(GNR) Posted September 28, 2010 Author Share Posted September 28, 2010 If it's a comand use playerSource that always work its not a command well, it puts out then if vehicle not; and other goes when it succeeds ( the command ) but varez, i think it is my problem, also the scripting thing tough im readin again now EDIT: can i ask some questions about it here? I think i created something thats ok, but i don't exactly get it it would be nice if someone would point me out the error: n = true function checkdamageproof () if isVehicleDamageProof n then outputChatBox ( "ERROR", playerSource, 0, 255, 0 ) end end BTW: it gives me those error's in script editor: Then expected near = (the line of vehicledamageproof) en expected near end like 3 times EDIT2: Lol, forgot to trigger Link to comment
dzek (varez) Posted September 28, 2010 Share Posted September 28, 2010 what is this isVehicleDamageProof n check wiki page for isVehicleDamageProof - as you can see you should pass vehicle element as argument - i cannot see any vehicle. think for a while. WHAT vehicle should be checked? there is NO word about vehicle in your script.. also arguments should be written in brackets - "(" and ")", also i dont see a point in this "n" - it's alwyas true? what is it doing here? you still dont get THE IDEA. you are doing just "random scripting" .. few words from wiki, and the magic should happen, right? you have to VERY precise when scripting.. Link to comment
Fabio(GNR) Posted September 28, 2010 Author Share Posted September 28, 2010 what is this isVehicleDamageProof n check wiki page for isVehicleDamageProof - as you can see you should pass vehicle element as argument - i cannot see any vehicle. think for a while. WHAT vehicle should be checked? there is NO word about vehicle in your script.. also arguments should be written in brackets - "(" and ")", also i dont see a point in this "n" - it's alwyas true? what is it doing here? you still dont get THE IDEA. you are doing just "random scripting" .. few words from wiki, and the magic should happen, right? you have to VERY precise when scripting.. Im not, im readin this tutorial: http://nixstaller.berlios.de/manual/0.2 ... statements but yes, i forgot to to select vehicle but before that function is the script from vehicle_panel for taalasmaa (permission to edit it) but why would it be always true, i read trough the introduction and some other tuts on that page and your links but anyway i'll try some thing, read , fail, try again and maybe succeed Link to comment
dzek (varez) Posted September 28, 2010 Share Posted September 28, 2010 why dont you read MTA tutorial from wiki? Link to comment
Fabio(GNR) Posted September 28, 2010 Author Share Posted September 28, 2010 (edited) why dont you read MTA tutorial from wiki? The one you send me? Introducing to scripting? i did that, or is there more stuff? But its kinda hard to understand everything, i did understand the introduction, but 2 things: Im dutch, i never scripted/programmed before, im willing to learn now. but it's kinda hard Edited September 28, 2010 by Guest Link to comment
dzek (varez) Posted September 28, 2010 Share Posted September 28, 2010 no, but you shouldnt make so much mistakes if you follow it carefully.. Link to comment
Fabio(GNR) Posted September 28, 2010 Author Share Posted September 28, 2010 (edited) no, but you shouldnt make so much mistakes if you follow it carefully.. Yes i was kinda into the variable thing that i forgot to add that EDIT: from my other post: But its kinda hard to understand everything, i did understand the introduction, but 2 things: Im dutch, i never scripted/programmed before, im willing to learn now. but it's kinda hard. but why would i need a variable if i only use it one time, or is a variable something else. cause at the tutorial's im following (links from main wiki page) don't really describe everything. EDIT2: I got it to work, thanks varez, im going further now, well it did go like this: i added a command handler that checks if your spawned vehicle (vehicle_panel) is damageproof, it will output ERROR when it is, and it worked now im gonna try to make it use the same command anyway i gotta go now thanks for the help EDIT3: 1 more small question before i leave: can i use like 2 if's? i want to put this one function checkdamageproof (playerSource) if isVehicleDamageProof ( vehicle ) then outputChatBox ( "ERROR", playerSource, 255, 0, 0 ) else outputChatBox ( " /cargod", playerSource, 0, 225, 0 ) end end together with this one: function godcar (g_Me) local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then outputChatBox("You have to be in a vehicle for CAR-god-mode!!",playerSource,255,0,0) else outputChatBox ( "Your car is now Damage-proof, Leaving vehicle will dis-able", playerSource, 0, 255, 0 ) setVehicleDamageProof(vehicle, true) end end addCommandHandler ( "cargod", godcar ) Vehicle is assigned before this function Edited September 28, 2010 by Guest Link to comment
dzek (varez) Posted September 28, 2010 Share Posted September 28, 2010 variable is thing when you are storing something. you can for example have variable like: allow_use_of_command = true and in function that runs on command you can check if it's true. if it's false - you won't allow to use it, and if it's true - you will do the action, and set it to false to prevent next use, and set timer to make it "true" again in next 6 seconds Link to comment
Fabio(GNR) Posted September 28, 2010 Author Share Posted September 28, 2010 variable is thing when you are storing something.you can for example have variable like: allow_use_of_command = true and in function that runs on command you can check if it's true. if it's false - you won't allow to use it, and if it's true - you will do the action, and set it to false to prevent next use, and set timer to make it "true" again in next 6 seconds Ok, i think i get it, so (bad funtcion) f unction example() if allow_use_of_command then script?? thanks , btw please look at edit of my previous post EDIT: lol, forgot elseif EDIT2: It works now, thanks alot varez, and minigoveya,but player colour still isn't good for me well, sometimes it works, sometimes it doesn't Link to comment
50p Posted September 28, 2010 Share Posted September 28, 2010 What problem with the colour do you have? Link to comment
Fabio(GNR) Posted September 28, 2010 Author Share Posted September 28, 2010 What problem with the colour do you have? Well, if i use outputChatBox ("text", playerSource, 210, 50, 155 ) (example) it won't show the colour , just the standard kinda white color. Link to comment
50p Posted September 28, 2010 Share Posted September 28, 2010 Because playerSource is nil? Link to comment
Fabio(GNR) Posted September 28, 2010 Author Share Posted September 28, 2010 Because playerSource is nil? Well, i tried Source before but minigoveya said try playerSource, it's kinda weird.... Link to comment
50p Posted September 28, 2010 Share Posted September 28, 2010 Hmmm... you tried source? But what is source? Him and you should learn more about what source is because that's one of the most important stuff you need to know about.. https://wiki.multitheftauto.com/wiki/Eve ... ent_source Also, don't come up with weird ideas.. I mean where would playerSource come from? You have to have variable declared before you use it unless you're sure you want to use it as nil Link to comment
Fabio(GNR) Posted September 28, 2010 Author Share Posted September 28, 2010 Hmmm... you tried source? But what is source? Him and you should learn more about what source is because that's one of the most important stuff you need to know about..https://wiki.multitheftauto.com/wiki/Eve ... ent_source Also, don't come up with weird ideas.. I mean where would playerSource come from? You have to have variable declared before you use it unless you're sure you want to use it as nil Yes this belongs to the script: ----------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- ---------------------------------------------------------------- ----------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- ------------------SCRIPT BY TAALASMAA (C) DO NOT EDIT THIS WITHOUT PERMISSIONS----- ----------------------------------------------------------------------------------- disallowedVehicle = {{425},{432}},{520} -- RHINO AND HUNTER -- ----------------------------------------- ---------------------------------------- --------CARSPAWN LIMIT------------------ carSpawnLimit = {2} -- can be changed -- NOT IN USE IN 0.1!!!!!! --- ---------------------------------------- ---------------------------------------- -------------------------- ------------------------- n = true function spawnAcar(carID, playerSource) for i,v in ipairs (disallowedVehicle) do if (v[1] == carID) then outputChatBox("This is disallowed vehicle!",source,255,0,0) return false end end playerX,playerY,playerZ = getElementPosition(source) vehicle = createVehicle ( carID,playerX + 2,playerY +2, playerZ ) warpPedIntoVehicle ( source, vehicle ) end function godcar (g_Me, playerSource) local vehicle = getPedOccupiedVehicle(g_Me) if not vehicle then outputChatBox("You have to be in a vehicle for CAR-god-mode!!",playerSource,255,0,0) elseif isVehicleDamageProof ( vehicle ) then outputChatBox("This vehicle already has Car-god-mode", playerSource,255,0,0) else outputChatBox("Your car is now Damage-proof, Leaving vehicle will dis-able",playerSource, 0,255,0) setVehicleDamageProof(vehicle, true) setVehicleDoorsUndamageable(vehicle, true) end end function stopgod () setVehicleDamageProof( vehicle, false ) end function instantstop () playerX,playerY,playerZ = getElementPosition(source) setElementPosition ( source,playerX,playerY, playerZ ) end addCommandHandler ( "cargod", godcar ) addEvent("onPlayerWantToSpawn",true); addEventHandler("onPlayerWantToSpawn",getRootElement(),spawnAcar) addEventHandler ( "onPlayerVehicleExit", getRootElement(), stopgod ) ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- And it works with the spawnAcar colour Edit: 1 offtopic question, can you destroyelement on a marker or on some kind?? Link to comment
50p Posted September 28, 2010 Share Posted September 28, 2010 Click the link I gave you in my previous post.. Don't be lazy and read the content of that page. Also, don't give up, if you don't understand it after first time reading because that's normal, read it again and again until you understand it because that page covers event system pretty well. Link to comment
Fabio(GNR) Posted September 29, 2010 Author Share Posted September 29, 2010 Click the link I gave you in my previous post.. Don't be lazy and read the content of that page. Also, don't give up, if you don't understand it after first time reading because that's normal, read it again and again until you understand it because that page covers event system pretty well. i read it, source is element or anything that triggered it, right? EDIT: it worked, by using g_Me thanks for info and link EDIT2: one small question is it normal that when i say something in chat it's double? i say test, and it does this: Fabio(GNR) TEST Fabio(GNR) TEST This is with everyone that played in my server, bug or something i messed up? EDIT3: OK, i found it's cause a resource, but it could take me hours to find in which resource, which file onplayerchat is Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now