-
Posts
1,803 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Citizen
-
There is no function for attach trailers to the train (read it would be done soon by devs a long time ago, so idk). The simpliest workaround I can imagine, is to logically attach them (using setElementParent for example) and then use getElementVelocity on the parent to set it to the child (the trailer of the locomotive, or the trailer of another trailer). Be sure to do that on the server side if you want it to be synced with everyone. 2 problems: 1 - it will need a lot of server resources (I mean the cpu) because the speed of the trailer needs to be updated all the time and as often as possible. 2 - you will surelly get the trailers getting at the wrong place while driving it. I mean that the children can go away from their parent slowly and you will be able to see it at some point. I also have another idea but harder than the first one. It will also use setElementVelocity but this time it will be based on the distance between the two attached parts (the trailer with the locomotive, or the trailer with another trailer). "It doesn't look hard" It is, because you can't just use getElementPosition on the trailers/locomotive because it will return the world position of the center of the trailer/locomotive. So you need to do some math (pretty much like in this function) to get the position of the back side of the parent and the front side of the child and only then use getDistanceBetweenPoints3D using the 2 calculated positions. This way, it will totally resolve the 2nd problem from the first idea, and partially resolve the 1st one (as it will still need to do some updates about the speed of each trailer but not as often as the 1st idea. I'm sure I can implement this 2nd idea using a setTimer of hmmmm let's say 800ms. I know it's still pretty fast, but the 1st idea will at least need a setTimer of 50 or 100 ms to looks good. I'll probably do a resource for that someday. (Remember I did that a long time ago, but the code is on the client-side and using invisible peds to drive the trailers and they are accelerating and braking at the same time as the visible ped in the locomotive. http://www.dailymotion.com/video/xcegb0 ... videogames )
-
@Anubhav and @Mr.Pres[T]ege: Never use global variables to store datas that belong to a specific player just because you need to access this data in another function on the server side. This is a really bad practice you are sharing with other scripters. Doing that will just introduce bugs in the system as mrbrutus1467 explained in his last paragraph. The real solution is to put the local keyword back and use the variable sent to that function: local money = math.random( 500, 30000 ) and
-
He won't work for you nor for free. If you want to order him scripts/systems for your server, just go to his website.
-
The scripters of that server added it obviously.
-
You could have fixed it yourself if you had read the code: local Bscore = 0 local Wscore = 0
-
It will surely only work for the 1st level, then he will get the same problem (the expbar going outside) because it's probably not 350 for each level. Please send us the link of that exp system and the configuration file if there is one.
-
Why are you trying to modify or to do the hard stuff when you are still a beginner ? You should first start by making easy systems with server and client codes (with dx functions maybe) before doing hard stuff like making your own radar. And yeah I'm helping you right now by saying that, for the future.
-
You can use the JR10 but I just wanted to say that most of the time, you won't get all the players to do the /vr because there is sometimes an afk, or the 1st player who doesn't want to restart because he is 1st. And even if you thought using it at the end of the map, there will be another guy who doesn't want to restart because he hates this map. So I would suggest half (1/2) or 2/3 of the player count. Also, use a variable to use it in the if statement of JR10 and in the outputs (I mean the "blabla ["..nbVotes.."/3]" ) local voteRequired = math.roof(getPlayerCount()/2) --for 1/2 -- or local voteRequired = math.roof(getPlayerCount()*2 / 3) --for 2/3
-
Post the whole script in pastebin and give the link here.
-
ok solid the top don't refresh . You said it was working ! Stop breaking the code and ask for help again. If you mean't auto-update, then use a setTimer to call U function every 2 secs when the "top" is visible.
-
Well, it's still there: What do you mean by that ? i explain that local host isn't mean MySql server to be same with Mta server Host That MySQL can be and on other Host That only SQL need to be in Same Host of Mta Server as it's a file SQL is just a language that SQL based applications can understand. There is a lot of SQL servers mike MySQL, postgre and others. You probably meant SQLite witch let you do the same things but the database is stored as a .db file. SELECT * FROM users; is a SQL query and can be executed on MySQL or SQLite. Hope it's more clear.
-
The code is correct but the problem is that its already existing somewhere else. Please remove the other one.
-
Why did you do that ? setPedAnimation(getLocalPlayer()) So you are making him dance and then cancelling it immediatly ... Here is the server-side version of your script: local DanceTable = {} table.insert(DanceTable, "bd_clap") --no need to specify the index (auto incrementing and starting at 1) table.insert(DanceTable, "bd_clap1") table.insert(DanceTable, "dance_loop") table.insert(DanceTable, "DAN_Down_A") table.insert(DanceTable, "DAN_Left_A") table.insert(DanceTable, "DAN_Loop_A") table.insert(DanceTable, "DAN_Right_A") table.insert(DanceTable, "DAN_Up_A") table.insert(DanceTable, "dnce_M_a") table.insert(DanceTable, "dnce_M_b") table.insert(DanceTable, "dnce_M_c") table.insert(DanceTable, "dnce_M_d") table.insert(DanceTable, "dnce_M_e") function Dance( player ) if not getElementData(player, "dancing") then local valRandom = math.random(#DanceTable) --#myTable returns the size of myTable outputChatBox("#0046C8[bF3]: Random Dance: "..tostring(DanceTable[valRandom]), 255,255,255,true) setPedAnimation(player, tostring(DanceTable[valRandom]), 5000, true, true, false) setElementData(player, "dancing", true) --used for the if statement end end addCommandHandler("Dance", Dance) To stop the animation: setPedAnimation(player) --cancelling the animation removeElementData(player, "dancing") --let the player to use /Dance again
-
How Can I change this language into text ??? Anyone can help me please ?? I've already tried to use google translator but I don't got any kind of help from there . Thankx Where did you get that, it's the scripting section here, I hope it's all about scripting ... By the way, it looks like a advertisement in chinese to buy wine or something.
-
Ok try this: local playerVotes = {} local nbVotes = 0 addCommandHandler( "vr", function( player ) if(playerVotes[player] == true) then return outputChatBox("#ff8800[REDO]: #ffffffYou have already voted", source, 255, 0, 0, true) end if not nbVotes then nbVotes = 0 end playerVotes[player] = true nbVotes = nbVotes + 1 if nbVotes >= 4 then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThe map will be restarted!", root, 255, 0, 0, true) elseif nbVotes == 3 then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).."#ffffff voted for redo! ["..nbVotes.."/3]", root, 255, 0, 0, true) outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThis map will be restarted by vote!", root, 255, 0, 0, true) g_ForcedNextMap = currentMap outputChatBox("DEBUG: Next map: "..tostring( getMapName(g_ForcedNextMap) ) ) setTimer(function() nbVotes = 0 end, 150*1000, 1) playerVotes = 3 else outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).." #ffffffvoted for redo! ["..nbVotes.."/3]", root, 255, 0, 0, true) end end) Be sure to put this script inside de race resource (in racevoting_server.lua for example) Tell me if it works, or if it's not, the errors and all the outputs in the chatbox (espacially the "DEBUG: Next map: " one).
-
Hehe and another typo fix local targetCurrentHealth = getElementHealth ( localPlayer ) if not targetCurrentHealth >= 100 then
-
You made a typo and better use >= just to be sure: local targetCurrentHealth = getElementHealth ( localPlayer ) if not targetCurrentHealth >= 100 then EDIT: Forwarding typo fix by Saml1er in case of a copy-paster comming through + another one
-
No I meant there are 2 resources that are respawning the player after his death. So there is your script which does that: function PlayerDeath ( ) setTimer ( SpawnPlayer, 1000, 1, source ) end function SpawnPlayer ( source ) spawnPlayer ( source, -1643.89941, 652.95648, -4.90625, 269.1424, 172 ) end but there is another resource (or another part of your script) which respawn dead players too. So you have to find which resource does that (by stopping resources 1 by 1 untill the problem disapear).
-
if ( players [ i ] )then guiGridListSetItemText( GridListTOP, aRow, 1, i ..'-', false, false ) guiGridListSetItemColor( GridListTOP, aRow, 1, , , ) guiGridListSetItemText( GridListTOP, aRow, 2, getPlayerName ( players [ i ].element ), false, false ) guiGridListSetItemColor( GridListTOP, aRow, 2, , , ) guiGridListSetItemText( GridListTOP, aRow, 3, tostring( players [ i ].kills ), false, false ) guiGridListSetItemColor( GridListTOP, aRow, 3, , , ) guiGridListSetItemText( GridListTOP, aRow, 4, getElementData ( players [ i ].element, 'Deaths' ), false, false ) guiGridListSetItemColor( GridListTOP, aRow, 4, , , ) end But replace ', , ' by the values of the color you want ( 255, 0, 0 means full red)
-
[PROBLEM] Can't connect to my server, MySQL and without it.
Citizen replied to [SG]Santeri's topic in Scripting
You just have to update your server -
Try this: addEventHandler ( "onPlayerJoin", root, function () bindKey ( source, "F2", "down", "vehiclemenu" ) end ) If it doesn't work, then try this workaround instead: addEventHandler ( "onPlayerJoin", root, function () bindKey ( source, "F2", "down", function ( player ) executeCommandHandler( "vehiclemenu", player ) end, source) end) If it's still not working, then try to bind it on another key.
-
Well, it's still there: What do you mean by that ?