-
Posts
353 -
Joined
-
Last visited
-
Days Won
3
Everything posted by LoPollo
-
i must have done an error i can't spot now... try changing the handler to use tutorial2: addEventHandler("onClientResourceStart", resourceRoot, tutorial1 ) change to addEventHandler("onClientResourceStart", resourceRoot, tutorial2 )
-
There was no error? weird I'm happy you fixed it
-
This is a feature request, so write the suggestion here to let it be discussed, and here for the actual request.
-
local cameraLocations = { { 1483.3354492188, -1719.1064453125, 50.896812438965, 1481.7545166016, -1803.435546875, -2.8257052898407 }, { 1429.7171630859, -1709.8178710938, 20.389394760132, 1345.8790283203, -1666.9763183594, -13.311774253845 }, { 1085.6225585938, -1797.7232666016, 19.463459014893, 1185.4050292969, -1796.0799560547, 25.848203659058 }, { 1199.8775634766, -1324.5711669922, 26.630777359009, 1108.8699951172, -1321.8992919922, -14.72714138031 }, { 1353.8889160156, -1280.1647949219, 19.625982284546, 1446.3851318359, -1283.6138916016, -18.22318649292 }, { 1418.2659912109, -890.18493652344, 85.20630645752, 1403.9643554688, -791.30133056641, 89.388885498047 }, } local cameraTimers = {} function tutorial1() for index,location in ipairs(cameraLocations) do --set the timers from location if isTimer( cameraTimers[index] ) then killTimer(cameraTimers[index]) cameraTimers[index] = nil end cameraTimers[index] = setTimer( setCameraMatrix, 5000*index, 1, --5s*1st location = 5s, 5s*2nd loc = 10s, 5s*6th loc = 30s location[1], location[2], location[3], location[4], location[5], location[6] ) end if isTimer( cameraTimers[0] ) then killTimer(cameraTimers[0]) cameraTimers[0] = nil end cameraTimers[0] = setTimer( setCameraTarget, 5000*(#cameraLocations+1), 1, localPlayer ) --the camera will return to player end local activeLocation function tutorial2() if not activeLocation then activeLocation = 1 end local location = cameraLocations[activeLocation] setCameraMatrix( location[1], location[2], location[3], location[4], location[5], location[6] ) if activeLocation < #cameraLocations then activeLocation = activeLocation + 1 setTimer( tutorial2, 5000, 1 ) else setCameraTarget( localPlayer ) end end addEventHandler("onClientResourceStart", resourceRoot, tutorial1 ) --or tutorial2 This is not tested, also i tried to be as clear as possible. Please note that these 2 are not the only nor the best ways to achieve what you want, but i think they are clean and easy to understand. But everyone understand in its own way, so if you have any question we're here to answer them.
-
I'm sorry, but i don't think there's anything like that. Also note that restarting a resource like you said will cause (obviously) the resource stop, and what about if the resource was doing something??? think about a "mission" resource, a player is in that mission and then.... the resource get restarted. No more mission... it's sad I think that having to do it manually is the best option available. Remember also that there are other ways to restart a resource other than from the server console: using the commands from an admin account, like /refresh and /restart someResource or with other resources like the admin panel
-
if not accblocked then return false end return accblocked --why don't you use return accblocked --or if you don't want nils return accblocked or false setElementData ( player, "AccountData:IP", ip ) else triggerClientEvent ( client, "setWarning", client, "Something went wrong while logging!", 255, 0, 0 ) --aren't player and client the same? it would be better to use only client addEventHandler( "SAEGLogin:onLogin", root, onLogin ) --THERE'S NO PROBLEM HERE --i just want you to remind, since you bound the event to root, that having root in the triggerEvent/triggerServerEvent as sourceElement is bad local accblock = accountBlocked(user) if ( account ~= false ) then --it's better to check if account is (not) false before calling accountBlocked: if ( account ~= false ) then local accblock = accountBlocked(user) About the problem outputChatBox(accblock) --i usually use iprint() or outputDebugString+tostring. I don't remember if booleans are printed. So... what happens in the chat? Does it print true? setElementData ( player, "AccountData:Serial", s ) setElementData ( player, "AccountData:IP", ip ) Ok... after seeing this, since i don't see neither s nor ip defined, i'm sure you didn't even tried to correct the script. Reading errors helps you and more importantly helps US if you want us to solve the script. That's why i usually ignore posts without enough informations about the problems, and that's why i'm annoyed now. I won't further read the script for now. Till you correct the above and, if it's not enough, until you explain more the problem (in this case i mean giving us the error log) i don't see why I (actually everyone) should help you with this. NOTE: i'm annoyed but that doesn't mean i won't help you if it's required. So if you prove that help is actually required, as i said i will be happy to help. But if you don't give us the error log (debugscript 3/serverl.log/clientscript.log) and you don't read it i feel like you think we are like a "fix-machine". We are here to help you in scripting, making you learn and learning ourself something everytime, we are not machines.
-
What do you mean? if you mean functions to access files, then they do exist: they are the file functions Edit: do you mean something like https://msdn.microsoft.com/it-it/library/system.io.filesystemwatcher(v=vs.110).aspx? So an event that get riggered when a file/directory gets an edit?
-
That's because that's not a correct for loop in this case it's also useful to use ipairs. Another thing: you will be overwriting cameraTimer In the below code i will be using local variables as they're faster local cameralocations = { { 1483.3354492188, -1719.1064453125, 50.896812438965, 1481.7545166016, -1803.435546875, -2.8257052898407 }, { 1429.7171630859, -1709.8178710938, 20.389394760132, 1345.8790283203, -1666.9763183594, -13.311774253845 }, { 1085.6225585938, -1797.7232666016, 19.463459014893, 1185.4050292969, -1796.0799560547, 25.848203659058 }, { 1199.8775634766, -1324.5711669922, 26.630777359009, 1108.8699951172, -1321.8992919922, -14.72714138031 }, { 1353.8889160156, -1280.1647949219, 19.625982284546, 1446.3851318359, -1283.6138916016, -18.22318649292 }, { 1418.2659912109, -890.18493652344, 85.20630645752, 1403.9643554688, -791.30133056641, 89.388885498047 }, } local cameraTimers = {} function tutorial() for index,location in ipairs(cameralocations) do if isTimer( cameraTimers[index] ) then killTimer(cameraTimers[index]) cameraTimers[index] = nil end cameraTimers[index] = setTimer( setCameraMatrix, 5000, 1, location[1], location[2], location[3], location[4], location[5], location[6] ) end end addEventHandler("onClientResourceStart", resourceRoot, tutorial) This should what you wanted to do. Also notice this is completely useless since the timers are going to be executed all after 5s, so actually only the last location will be shown: wait 5s, set camera matrix to loc1, set camera matrix to loc2, ......., set camera matrix to loc6 -> only loc6 landscape will be visible (loc stands for location) If you want to change the location every 5s in a loop then tell us and it will be shown to you. like this: set to loc1, wait 5s, set to loc2, wait 5s, set to loc3, wait5s, ...., set to loc6, wait 5s, restart from loc1
-
Abbass_gamer100, i didn't followed entirely the thread so can you sum up what's the problem? logIn is a function that is used to bind a player element to an account element. From the serverside script i feel the script more like a "password" for the server, and not an account, so i'm confused. If you want to bind a player to an account, allowing you to save persistent data for every player that login in that account then the answer is yes. Simply get the text in the edit boxes, trigger a server event (remember to use client predefined variable serverside, and to not set root as source) passing the account name and the password, then use logIn to login the player.
-
Use the code block/spoiler/whatever the name is: it's located near the quote button on the top of the edit space of your reply The problem is not clear, but i guess you are looking for getTime and setTime. Otherwise explain more.
-
This is not enough, tell him also to fix the loop
-
outputDebugscript ~= outputDebugString Line 9, also i think you didn't copied-pasted the error, since that doesn't match with reality. It's good habit to copy paste errors to prevent these issues, also give us the lines at which the error say the problem is: --error is [2016-10-13 19:47:27] ERROR: someRes\main.lua:35: attempt to concatenate global 'someVar' (a nil value) local somf = function(a,b,c) --this is line 33 statement1() local str = tostring(a*b+c)..someVar outputChatBox(str) return 4 end function asdf() --other code end Then we know line 35 is line 5 in this block, and then we know where to see
-
You said the gui shows up -> the meta.xml makes the script run in clientside, so the meta.xml is ok The problem is in the script: the easiest and fastest way to solve an issue is reading the errors a script produce. You can do this checking the log (since this script it's clientside you must check MTA San Andreas 1.5\MTA\logs\clientscript.log) or directly in-game using debugscript 3. So my question is: what's in these files? Look for lines like this: [date and time] [resourceName]\Spawn_Panel.lua:[Line of the error]: [error]
-
the gui is partly working, that means the file is loaded in the client, and thus the meta is correct on this
-
a resource in admin acl group is a resource that have access to functions available to that acl group: see acl.xml (if i remember right), it will help you have an idea on this
-
Are there errors reported? Also try adding some output (debug/chatbox... whatever you want) so you can see what the script is executing
-
addEventHandler("onClientGUIClick", resourceRoot, function() if source == gridroom then local row = guiGridListGetSelectedItem(gridroom) local Text = guiGridListGetItemText(gridroom, row, clm) if Text == "*[ #_iMr,[E]coo RooM ]" then if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr4) or isElement(gridplr2) or isElement(gridplr5) then destroyElement ( grid4545 ) destroyElement ( gridplr3 ) destroyElement ( gridplr2 ) destroyElement ( gridplr4 ) destroyElement ( gridplr5 ) gridplr = guiCreateGridList(582, 60, 265, 240, false, teamspeak) clmp = guiGridListAddColumn(gridplr, "Players In RooM", 0.9) for i,v in ipairs(getElementsByType("player")) do if ( getElementData ( v,'data' ) == true ) then local plrrom = guiGridListAddRow(gridplr) guiGridListSetItemText(gridplr,plrrom,clmp,getPlayerName(v),false,false) elseif Text == "*[ NoName RooM ]" then if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr4) or isElement(gridplr) or isElement(gridplr5) then destroyElement ( grid4545 ) destroyElement ( gridplr ) destroyElement ( gridplr3 ) destroyElement ( gridplr4 ) destroyElement ( gridplr5 ) gridplr2 = guiCreateGridList(582, 60, 265, 240, false, teamspeak) clmp2 = guiGridListAddColumn(gridplr2, "Players In RooM", 0.9) for i,v in ipairs(getElementsByType("player")) do if ( getElementData ( v,'data2' ) == true ) then local plrrom2 = guiGridListAddRow(gridplr2) guiGridListSetItemText(gridplr2,plrrom2,clmp2,getPlayerName(v),false,false) elseif Text == "[2 2] غرفة للشخصين" then if isElement(grid4545) or isElement(gridplr) or isElement(gridplr4) or isElement(gridplr2) or isElement(gridplr5) then destroyElement ( grid4545 ) destroyElement ( gridplr ) destroyElement ( gridplr2 ) destroyElement ( gridplr4 ) destroyElement ( gridplr5 ) gridplr3 = guiCreateGridList(582, 60, 265, 240, false, teamspeak) clmp3 = guiGridListAddColumn(gridplr3, "Players In RooM", 0.9) for i,v in ipairs(getElementsByType("player")) do if ( getElementData ( v,'data3' ) == true ) then local plrrom3 = guiGridListAddRow(gridplr3) guiGridListSetItemText(gridplr3,plrrom3,clmp3,getPlayerName(v),false,false) elseif Text == "[3 3] غرفة للثلاث اشخاص" then if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr) or isElement(gridplr2) or isElement(gridplr5) then destroyElement ( grid4545 ) destroyElement ( gridplr ) destroyElement ( gridplr2 ) destroyElement ( gridplr3 ) destroyElement ( gridplr5 ) gridplr4 = guiCreateGridList(582, 60, 265, 240, false, teamspeak) clmp4 = guiGridListAddColumn(gridplr4, "Players In RooM", 0.9) for i,v in ipairs(getElementsByType("player")) do if ( getElementData ( v,'data4' ) == true ) then local plrrom4 = guiGridListAddRow(gridplr4) guiGridListSetItemText(gridplr4,plrrom4,clmp4,getPlayerName(v),false,false) elseif Text == "[4 4] غرفة للاربع اشخاص" then if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr4) or isElement(gridplr2) or isElement(gridplr) then destroyElement ( grid4545 ) destroyElement ( gridplr ) destroyElement ( gridplr2 ) destroyElement ( gridplr4 ) destroyElement ( gridplr3 ) gridplr5 = guiCreateGridList(582, 60, 265, 240, false, teamspeak) clmp5 = guiGridListAddColumn(gridplr5, "Players In RooM", 0.9) for i,v in ipairs(getElementsByType("player")) do if ( getElementData ( v,'data5' ) == true ) then local plrrom5 = guiGridListAddRow(gridplr5) guiGridListSetItemText(gridplr5,plrrom5,clmp5,getPlayerName(v),false,false) end end end end end end end end end end end end end end end end end ) and for sure i made errors in tabulation... i don't think a correction is necessary here, nor is necessary to find the problem: there's a BIG problem before, which is also probably the cause of the fact the script isn't working. I will have more time tomorrow, in the meantime: use indentation, it solves so many issues and helps readability. The FIRST thing i do, and i think everyone should do, is to indentate when correcting a non-correctly indentated script (sry for bad eng) "fix" the loops, they are "overlapped" if i see right I may have done some errors, otherwise the function is not closed as some ends are missing. Sorry for every error i could have made, i'm tired at the moment.
-
Didn't see scipt, it should be script (meta.xml@Line 4)
-
yes, it's in the meta line 4: replace type="server" with type="client"
-
Another note i didn't see: getLocalPlayer() = localPlayer, just so you know. About the problem: In the server? Here i can't see errors. Did you use debugscript 3? just to make sure there are no syntax errors... If there are not errors then i would do this: using outputDebugString/iprint to check where the code runs and where not. function createSpawningPanel() SpawnWindow = guiCreateWindow(319, 196, 408, 277, "Base Spawning Panel", false) guiWindowSetMovable(SpawnWindow, false) guiWindowSetSizable(SpawnWindow, false) guiSetVisible(SpawnWindow,false) Button[1] = guiCreateButton(17, 38, 376, 73, "Go to the base", false, SpawnWindow) addEventHandler("onClientGUIClick", Button[1], teleportPlayer, false) Button[2] = guiCreateButton(14, 161, 379, 71, "Kill yourself", false, SpawnWindow) addEventHandler("onClientGUIClick", Button[2], teleportPlayer, false) outputDebugString( "CreateSpawningPanel called and completed!" ) end addEventHandler("onClientResourceStart", resourceRoot, function () createSpawningPanel() end ) function openSpawnWindow() guiSetVisible( SpawnWindow, true ) showCursor( true, true ) outputDebugString( "opened window! [i feel useless]" ) end addCommandHandler( "teleportme", openSpawnWindow ) function teleportPlayer(button,state) if button == "left" and state == "up" then outputDebugString( "Executing teleportPlayer" ) if source == Button[1] then triggerServerEvent( "movePlayerToPosition", localPlayer, 1479.6,-1612.8,14.0,0 ) outputDebugString( "Button 1 pressed" ) elseif source == Button[2] then killPed(sourcePlayer,sourcePlayer) outputDebugString( "Button 2 pressed" ) end guiSetVisible(SpawnWindow,false) showCursor(false) outputDebugString( "teleportPlayer executed!" ) end end Tell us what's shown and what not
-
Use code instead of quote next time, it helps readability a lot. just a note (not an error!): getResourceRootElement(getThisResource()) = resourceRoot, getThisResource() = resource (these are predefined variables) Calling addEventHandler with Button when it's nil won't add the handler. Even the function teleportPlayer wasn't define at that point in the code. So below there's the code without these 2 errors, try it. As always, it's untested and read quickly, so tell us if it solved the issue and if it didn't also include errors, since both of the above said problems produce errors. Use debugscript 3 when scripting an testing, otherwise check the logs (clientscript.log and server.log) function createSpawningPanel() SpawnWindow = guiCreateWindow(319, 196, 408, 277, "Base Spawning Panel", false) guiWindowSetMovable(SpawnWindow, false) guiWindowSetSizable(SpawnWindow, false) guiSetVisible(SpawnWindow,false) Button[1] = guiCreateButton(17, 38, 376, 73, "Go to the base", false, SpawnWindow) addEventHandler("onClientGUIClick", Button[1], teleportPlayer, false) Button[2] = guiCreateButton(14, 161, 379, 71, "Kill yourself", false, SpawnWindow) addEventHandler("onClientGUIClick", Button[2], teleportPlayer, false) end addEventHandler("onClientResourceStart", resourceRoot, function () createSpawningPanel() end ) function openSpawnWindow() guiSetVisible( SpawnWindow, true ) showCursor( true, true ) end addCommandHandler( "teleportme", openSpawnWindow ) function teleportPlayer(button,state) if button == "left" and state == "up" then if source == Button[1] then triggerServerEvent("movePlayerToPosition",getLocalPlayer(),1479.6,-1612.8,14.0,0) elseif source == Button[2] then killPed(sourcePlayer,sourcePlayer) end guiSetVisible(SpawnWindow,false) showCursor(false) end end Remember that the more detailed and accurated the description of the problem is, the faster and better the fix, correction or workaround come.
-
They are Well, actually the script is usable for who is in the team "Admins", and that doesn't mean necessary that he's an admin (getTeamName). But i doubt that servers will make a team called "Admins" for non-admin players. I'm not expert about this, but in the worst case (with this script) a non-admin will be able to fly. I don't think it does really matter since he will then be recognised by everyone who see him and thus get banned/kicked/whatever. I think it's not easy to hack even the team part, and for sure it's not worth it. Doing checks not on the team but on the isObjectInACLGroup, and then telling the client is able or not to fly (and yet this could be hacked). But still the calculation of velocity etc must be done clientside to obtain "smoothness" and "responsiveness". So, the script, after a quick read, seems ok. NOTE: i'm not expert about hacking of MTA and EVERYTHING of what i said is not tested in any pratical way. If anyone has any further detail i hope to see it.
-
That means they do not exist in the server. You can destroy (or hide them) using events like onClientPlayerVehicleExit, onClientVehicleExit and so on Otherwise rethink your script Good luck
-
--client addEventHandler( "onClientGUIClick", root, function() if source == GUIEditor.button[1] then triggerServerEvent ( "GoToAFK", localPlayer ) --triggerServerEvent ( "UnAFK", localPlayer ) guiSetText ( GUIEditor.button[1], "AFK" ) end end ) --server addEvent( "GoToAFK", true ) addEventHandler( "GoToAFK", root, function() --client is the player whose script called triggerServerEvent exports.voice:setPlayerChannel ( client , 6 ) exports.voice:setPlayerVoiceMuted ( client, true ) --old setPlayerMuted end )