TheGamingMann
Members-
Posts
54 -
Joined
-
Last visited
Everything posted by TheGamingMann
-
Your welcome for the help.
-
I am new at scripting but I see what you are missing. Try this: Client: addEventHandler("onClientResourceStart",resourceRoot,function() fadeCamera(true) triggerServerEvent("onPlayerFilesDownloaded",localPlayer) end) Server: addEventHandler("onPlayerJoin",root,function() fadeCamera(source,false,0) end) addEvent("onPlayerFilesDownloaded",true) addEventHandler("onPlayerFilesDownloaded",root,function() spawnPlayer(source,2125.7995605469,-1545.5288085938,302.15188598633) fadeCamera(source, true) setCameraTarget(source) end) Note: Tested and seems to work fine.
-
Yeah I noticed that. I was thinking about it but I didn't want to totally screw my whole mode up. Thanks again. Oh and one question. How can I have a guiElement stay on the screen for 30 seconds? I got the timer but currently it is just delay. I want it to come up and stay for 30 seconds then be gone. Thanks.
-
B-E-A-UTILFUL! Sorry for the caps. Thanks for the help solidsnake again. You are really good at this. Thanks man.
-
Its the same code you helped me with last time. Sorry I left that out. function fillLoadList() local file = xmlLoadFile("loads.xml") if (file) then local childs = xmlNodeGetChildren(file) local randomChilds = {} for index = 1, 3 do table.insert(randomChilds, childs[math.random(#childs)]) end for _, loads in ipairs (randomChilds) do local row = guiGridListAddRow(glistLoadList) local attrs = xmlNodeGetAttributes(loads) local startx = attrs.startx local starty = attrs.starty local startz = attrs.startz local endx = attrs.endx local endy = attrs.endy local endz = attrs.endz local cash = attrs.cash guiGridListSetItemText(glistLoadList, row, 1, attrs.cargo, false, false) guiGridListSetItemText(glistLoadList, row, 2, attrs.pickup, false, false) guiGridListSetItemData(glistLoadList, row, 2, {attrs.startx, attrs.starty, attrs.startz}) guiGridListSetItemText(glistLoadList, row, 3, attrs.dropoff, false, false) guiGridListSetItemData(glistLoadList, row, 3, {attrs.endx, attrs.endy, attrs.endz}) guiGridListSetItemText(glistLoadList, row, 4, attrs.pay, false, false) guiGridListSetItemData(glistLoadList, row, 4, attrs.cash) end xmlUnloadFile(file) end end
-
With this script I plan to have it unpack the data (startx, starty, etc.) from the grildist data. But I keep getting the error of Bad Argument: expected Table got nil. I am not sure why this is happening because I do have it as a table in the gridlist as a table. Please help in anyway you can. Thanks in advance. function loadHandler(button, state) if button == "left" and state == "up" then local row, col = guiGridListGetSelectedItem(glistLoadList) local data = guiGridListGetItemData(glistLoadList, row, col) if row and col and row ~= -1 and col ~=-1 then local startx, starty, startz, endx, endy, endz, cash = unpack(data) triggerEvent("startLoad", localPlayer, startx, starty, startz, endx, endy, endz, cash) end end end function beginLoad(startx, starty, startz, endx, endy, endz, cash) createMarker(startx, starty, startz, "checkpoint", 5) createBlip(-102, -70, 5, 0, 2, 0, 0, 255) end addEvent("startLoad", false) addEventHandler("startLoad", localPlayer, beginLoad)
-
[SOLVED] Random info pulled from XML/Getting Players Veh ID
TheGamingMann replied to TheGamingMann's topic in Scripting
Sweet thanks guys. Works like a charm! -
[SOLVED] Random info pulled from XML/Getting Players Veh ID
TheGamingMann replied to TheGamingMann's topic in Scripting
So I have it set to a command of /w it will show the GUI when I type it in when within the vehicle. But outside any car it runs the chatbox thing that I set but runs the error to /scriptdebug 3 saying Bad Argument. But it works so thanks. -
[SOLVED] Random info pulled from XML/Getting Players Veh ID
TheGamingMann replied to TheGamingMann's topic in Scripting
It works now. But still outputs an error when not in any car. -
[SOLVED] Random info pulled from XML/Getting Players Veh ID
TheGamingMann replied to TheGamingMann's topic in Scripting
Hmm. I just tried the getElementModel but I get the invalid argument error in game. -
[SOLVED] Random info pulled from XML/Getting Players Veh ID
TheGamingMann replied to TheGamingMann's topic in Scripting
Ohh okay. Thanks. I must have skimmed past that in the Wiki.. My bad. Thanks guys! -
[SOLVED] Random info pulled from XML/Getting Players Veh ID
TheGamingMann replied to TheGamingMann's topic in Scripting
Oh okay so what can I use to get the vehicle name that the player is sitting in? -
[SOLVED] Random info pulled from XML/Getting Players Veh ID
TheGamingMann replied to TheGamingMann's topic in Scripting
Sweet it works. Thanks Solidsnake. Now do you think you can point me in the right direction for the vehicle ID issue. -
[SOLVED] Random info pulled from XML/Getting Players Veh ID
TheGamingMann replied to TheGamingMann's topic in Scripting
I tried that and now it is just loading the last item in the loads.xml. Here is the new code. And the XML file. c_load.lua function fillLoadList() local file = xmlLoadFile("loads.xml") if (file) then local childs = xmlNodeGetChildren(file) local randomChilds = {} for index = 1, 3 do table.insert(randomChilds, childs[#childs]) end for _, loads in ipairs (randomChilds) do local row = guiGridListAddRow(glistLoadList) local attrs = xmlNodeGetAttributes(loads) local startx = attrs.startx local starty = attrs.starty local startz = attrs.startz local endx = attrs.endx local endy = attrs.endy local endz = attrs.endz guiGridListSetItemText(glistLoadList, row, 1, attrs.cargo, false, false) guiGridListSetItemData(glistLoadList, row, 1, {attrs.startx, attrs.starty, attrs.startz}) guiGridListSetItemText(glistLoadList, row, 2, attrs.pickup, false, false) guiGridListSetItemText(glistLoadList, row, 3, attrs.dropoff, false, false) guiGridListSetItemText(glistLoadList, row, 4, attrs.pay, false, false) end xmlUnloadFile(file) end end loads.xml "Food1" pickup="Here" dropoff="There" startx="100" starty="100" startz="100" endx="101" endy="101" endz="101" pay="100"/> "Food2" pickup="Here" dropoff="There" startx="100" starty="100" startz="100" endx="101" endy="101" endz="101" pay="100"/> "Food3" pickup="Here" dropoff="There" startx="100" starty="100" startz="100" endx="101" endy="101" endz="101" pay="100"/> "Food4" pickup="Here" dropoff="There" startx="100" starty="100" startz="100" endx="101" endy="101" endz="101" pay="100"/> "Food5" pickup="Here" dropoff="There" startx="100" starty="100" startz="100" endx="101" endy="101" endz="101" pay="100"/> "Food6" pickup="Here" dropoff="There" startx="100" starty="100" startz="100" endx="101" endy="101" endz="101" pay="100"/> -
[SOLVED] Random info pulled from XML/Getting Players Veh ID
TheGamingMann replied to TheGamingMann's topic in Scripting
Sorry. I am quite new to scripting MTA. I have loaded the XML file and filled the list like this: But it will fill it with the whole XML file. I would only like 3 random ones. How can I go about it now? Sorry if this is bugging you but I am quite new so. -
I have yet to make a script that does this but I would like some help being pushed in the right direction. I have this script and I want to pull things from an XML file. (I can do that part.) but I only want 3 random things showing in the gridlist not all of them. I am not sure how to do this. One other issue I am having is trying to get the ID of a vehicle. Here is the code I am using now: function showLoad() local vehicle = getPedOccupiedVehicle(source) local id = getVehicleModelFromName(vehicle) if id == 403 then if not guiGetVisible(wdwLoad) then guiSetVisible(wdwLoad, true) showCursor(true, true) end else outputChatBox("you are not in a car!", source) end end addCommandHandler("work", showLoad) addCommandHandler("w", showLoad)
-
Was that the issue?
-
Did you add that resource that is attempting to start something else to the ACL? it is saying there is no permission to run that command. You should add it to the admin ACL by doing . I think that is correct.
-
I would suggest using the gui editor resource to help you start building the gui.
-
[HELP] Removing the ACL Login Message - SOLVED
TheGamingMann replied to TheGamingMann's topic in Scripting
No. That is just keeping the message thanks for trying anyway. I will just clear it before outputting mt own I guess. -
Okay. I did what I can. I am not one to work with teams as I have yet to try them out. I got the window to show and the car to spawn and have the player warped into it. Server Side: function giveJob() local veh = createVehicle(416, -2591, 584, 15) -- ID X Y and Z warpPedIntoVehicle(source, veh) -- Warps the Player into the Created Car triggerClientEvent("hideMedic", source) end addEvent("setJob", true) addEventHandler("setJob", root, giveJob) -- Adds the Command for Medic members to heal players local range = 50 addCommandHandler('heal', -- creates the command /heal function(p,c,who) local who = getPlayerFromName(who) if who then local mx,my,mz = getElementPosition(p) local ux,uy,uz = getElementPosition(who) if getDistanceBetweenPoints3D(mx,my,mz,ux,uy,uz) <= range then if getPlayerTeam(p) == getTeamFromName("Medic") then -- only for medics able setElementHealth(who, 100) -- sets full health givePlayerMoney(who, -100) -- Takes 100$ for healing end else outputChatBox("This player is too far away",p,0,0,225) end else outputChatBox('Player not found.',p,0,0,255) end end ) Client Side: local theMarker = createMarker(1103.3049316406, 1079.1077880859, 9.8359375, "cylinder", 1, 0, 0, 200, 170) -- creates the marker local blip = createBlip(1103.3049316406, 1079.1077880859, 10.8359375, 22, 2) -- creates the hospital blip function createMedicGUI() wdwJob = guiCreateWindow(0.29, 0.24, 0.42, 0.49, "", true) guiWindowSetSizable(wdwJob, false) btnAccept = guiCreateButton(0.60, 0.20, 0.34, 0.17, "Accept Job", true, wdwJob) guiSetFont(btnAccept, "sa-header") btnClose = guiCreateButton(0.67, 0.61, 0.20, 0.16, "CLOSE", true, wdwJob) guiSetProperty(btnClose, "NormalTextColour", "FFAAAAAA") memInfo = guiCreateMemo(0.08, 0.20, 0.41, 0.67, "Become a Medic and heal people by using the command /heal [player]!", true, wdwJob) guiMemoSetReadOnly(memInfo, true)-- makes memo read only. addEventHandler("onClientGUIClick", btnClose, hideJob, false) addEventHandler("onClientGUIClick", btnAccept, jobHandler, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), -- creates and hides the window function() createMedicGUI() guiSetVisible(wdwJob, false) end ) function showJob() -- shows the window upon request if not guiGetVisible(wdwJob) then guiSetVisible(wdwJob, true) showCursor(true, true) end end addEvent("showMedic", true) addEventHandler("onClientMarkerHit", theMarker, showJob) -- server side "onMarkerHit" was not working so I went to client side for it function hideJob() -- hides the window upon request guiSetVisible(wdwJob, false) showCursor(false, false) end addEvent("hideMedic", true) addEventHandler("hideMedic", localPlayer, hideJob) function jobHandler() -- tells the server when the player accepted the job triggerServerEvent("setJob", localPlayer) end I am not sure about the command part. I just left it in there so you can still code off it. Hopefully someone else can contribute and me and you can learn something.
-
He means your code is a mess e.g. You have local createCar() this is not even how to correctly write a local variable. I am not the most competent coder but this really needs a make over. When I am back on my PC I will do my best to fix it up a bit for you.
-
x would be your serverside. just look at the name "client" would mean client side. Also you can check the meta with the types.
-
[HELP] Removing the ACL Login Message - SOLVED
TheGamingMann replied to TheGamingMann's topic in Scripting
Sorry for the slow response. But here are some screen shot. Red Box = Wish to Remove Green Box = Keep Sorry for the messy job. Its just the yellow text that I don't want there. -
[HELP] Removing the ACL Login Message - SOLVED
TheGamingMann replied to TheGamingMann's topic in Scripting
Sorry for the second bump but I have not found any way to do this.
