-
Posts
138 -
Joined
-
Last visited
Everything posted by Army@1
-
Little mistake there, you forgot to attach the function to the event.
-
Or this: local Door4 = createObject(980,2087.5,1433.1999511719,12.300000190735,0,359.75,89.499969482422) local markerDoor4 = createMarker(2088.3000488281,1433.3000488281,9.8000001907349,'cylinder',8,0,0,0,0) addEventHandler('onMarkerHit',markerDoor4, function ( hitElement2 ) if getElementType ( hitElement2 ) == "player" then if isPedInVehicle ( hitElement2 ) then moveObject(Door4,1000,2087.5,1433.1999511719,7.1999998092651) end end ) If for some reason, the above doesn't work, this should: local Door4 = createObject(980,2087.5,1433.1999511719,12.300000190735,0,359.75,89.499969482422) local markerDoor4 = createMarker(2088.3000488281,1433.3000488281,9.8000001907349,'cylinder',8,0,0,0,0) addEventHandler('onMarkerHit',markerDoor4, function ( hitElement2 ) if getElementType ( hitElement2 ) == "vehicle" then if isElement ( getVehicleOccupant ( hitElement2 ) ) then moveObject(Door4,1000,2087.5,1433.1999511719,7.1999998092651) end end )
-
IIYAMA, just asking out of curiosity. Is the below code is equivalent to the above one? for i=1, 4 do guiGridListRemoveRow ( tGrid, row4 ) end
-
This script will add a command which when executed will change player's vehicle mass to 300. function setVehicleMass(thePlayer) local pVehicle = getPedOccupiedVehicle(thePlayer) if pVehicle then setVehicleHandling (pVehicle, "mass", 300.0) end end addCommandHandler("mass",setVehicleMass)
-
Run this script and tell us what it outputs in the chatbox. jWin = guiCreateWindow(550,560,200,200,"Vehicle System",false) guiSetVisible(jWin,false) function openGui() guiSetVisible(jWin,true) function spawnveh(button, press, p) if(press) then if(button == "1") then x, y, z = getElementPosition(localPlayer) triggerServerEvent("crVeh", getRootElement(), 468, x, y, z, localPlayer) end if(button == "2") then x, y, z = getElementPosition(localPlayer) triggerServerEvent("crVeh", getRootElement(), 457, x, y, z, localPlayer) end if(button == "3") then x, y, z = getElementPosition(localPlayer) triggerServerEvent("crVeh", getRootElement(), 412, x, y, z, localPlayer) end if(button == "4") then x, y, z = getElementPosition(localPlayer) triggerServerEvent("crVeh", getRootElement(), 522, x, y, z, localPlayer) end if(button == "5") then x, y, z = getElementPosition(localPlayer) triggerServerEvent("crVeh", getRootElement(), 560, x, y, z, localPlayer) end if(button == "6") then x, y, z = getElementPosition(localPlayer) triggerServerEvent("crVeh", getRootElement(), 411, x, y, z, localPlayer) end if(button == "7") then outputChatBox("Player rank is: "tostring(getElementData(localPlayer, "VIP"))) end end end end end addEventHandler("onClientKey", getRootElement(), spawnveh) guiWindowSetSizable(jWin,false) tGrid = guiCreateGridList(0,20,190,170,false,jWin) guiGridListAddColumn(tGrid, "Key", 0.20) guiGridListAddColumn(tGrid, "Name", 0.65) row1 = guiGridListAddRow(tGrid) row2 = guiGridListAddRow(tGrid) row3 = guiGridListAddRow(tGrid) row4 = guiGridListAddRow(tGrid) row5 = guiGridListAddRow(tGrid) row6 = guiGridListAddRow(tGrid) row7 = guiGridListAddRow(tGrid) guiGridListSetItemText(tGrid, row1, 1, tostring(row1+1), false, false) guiGridListSetItemText(tGrid, row1, 2, "Sanchez", false, false) guiGridListSetItemText(tGrid, row2, 1, tostring(row2+1), false, false) guiGridListSetItemText(tGrid, row2, 2, "Caddy", false, false) guiGridListSetItemText(tGrid, row3, 1, tostring(row3+1), false, false) guiGridListSetItemText(tGrid, row3, 2, "Voodoo", false, false) guiGridListSetItemText(tGrid, row4, 1, tostring(row4+1), false, false) guiGridListSetItemText(tGrid, row4, 2, "NRG-500", false, false) guiGridListSetItemText(tGrid, row5, 1, tostring(row5+1), false, false) guiGridListSetItemText(tGrid, row5, 2, "Sultan", false, false) guiGridListSetItemText(tGrid, row6, 1, tostring(row6+1), false, false) guiGridListSetItemText(tGrid, row6, 2, "Infernus", false, false) guiGridListSetItemText(tGrid, row7, 1, tostring(row7+1), false, false) guiGridListSetItemText(tGrid, row7, 2, "Intruder", false, false) end addEvent("markerHitted", true) addEventHandler("markerHitted", getRootElement(), openGui) function hideGui() guiSetVisible(jWin,false) removeEventHandler("onClientKey", getRootElement(), spawnveh) end addEvent("markerLeaved", true) addEventHandler("markerLeaved", getRootElement(), hideGui)
-
I find it more helpful to think of 'piraterpg.money' as a variable and playerMoney as its definition Oops, corrected.
-
If you have never script anything in MTA. This is the right place to start https://wiki.multitheftauto.com/wiki/Sc ... troduction You can find many scripting tutorials, most of them are basic ones, at: https://forum.multitheftauto.com/viewforum.php?f=148&start=50 Here is a moving gates tutorial: https://forum.multitheftauto.com/viewtopic.php?f=148&t=53694
-
Did you try reinstalling MTA as a whole?
-
setAccountData(playerAccount, "piraterpg.money", playerMoney) Here, 'piraterpg.money' is a key and 'playerMoney' money is a value. The key can have any name 'acb', '12jsdhi', 'MyMoney', etc.. And the value can have things like player's weapon, money, position, rotation, health state, etc.. You can think of keys as variables and values as definitions. Example:- So lets say a player have $1650 cash when he quit the game. And you want to give player the amount of money he left the game with, which is $1650, when he join the game again. So when he quit, you would save his money by doing playerMoney = getPlayermoney(player) -- player's money which is 1650 playerAccount = getPlayerAccount(player) -- player's account setAccountData(playerAccount,"poorPlayerMoney",playerMoney) -- save player's money to his account with key 'poorPlayerMoney' And when he join, you would load his money by doing playerAccount = getPlayerAccount(player) -- player's account playerMoney = getAccountData(playerAccount,"poorPlayerMoney") -- will return 1650 givePlayerMoney(player, playerMoney) -- will give 1650 to player And I added comments to your last code. function onPlayerQuit_handler() local playerAccount = getPlayerAccount(source) -- get player account if (playerAccount) then -- if player has an account or account exist local walk = getPedWalkingStyle(source) -- get the current walking style of player and set it to variable 'walk'. setAccountData(playerAccount, "walkingstyle", walk) -- save/set player's walking style in player's account [data] with key 'walkingstyle' end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit_handler) -- trigger the function when player quit ---------------------------------------------------- ---------------------------------------------------- function onPlayerLogin_handler() local playerAccount = getPlayerAccount(source) -- get player account if (playerAccount) then -- if player has an an account or account exist local walk = getAccountData(playerAccount, "walkingstyle") -- load/get player's walking style with key 'walkingstyle' which was previously saved in his account if (walk) then -- if player's account data exist with key 'walkingstyle' or succesfully got player's account data with key 'walkingstyle setPedWalkingStyle(source, walk) -- set player's walking style to it(previous one) end end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin_handler) -- trigger the function when player login Hope it helps.
-
From wiki: 'a colshape created on the client does not collide with elements already existing at that location until they first move' I don't know if yours is client or server but seems it is not working because the object hasn't moved after the creation of the colshape or perhaps the problem is in real code and not this demo.
-
From wiki: 'A guest account is an account automatically created for a user when they join the server and deleted when they quit or login to another account' function showGUI() if isGuestAccount(getPlayerAccount(localPlayer)) then guiSetVisible(loginGUI["window"], true) showCursor (true) else guiSetVisible(loginGUI["window"], false) showCursor(false) end end addEventHandler ( "onClientResourceStart", getRootElement(), showGui )
-
function test ( ) for i,v in pairs(getElementsByType("vehicle")) do id = getElementModel ( v ) if id == 411 then exports [ "extra_health" ]:setElementExtraHealth(id, 50000000) end end addEventHandler("onResourceStart",getRootElement(),test)
-
local player = getLocalPlayer () font = guiCreateFont( "font.TTF", 14 ) marker1 = createMarker ( 759.08984375, -59.798828125, 999.7802124023, "cylinder", 1.5, 100, 0, 0, 255 ) marker2 = createMarker ( 773.375, 5.2412109375, 999.7802124023, "cylinder", 1.5, 100, 0, 0, 255 ) marker3 = createMarker ( 756.443359375, -48.0576171875, 999.7802124023, "cylinder", 1.5, 100, 0, 0, 255 ) blip1 = createBlip( 1968.8681640625, 2295.1806640625, 54, 54 ) blip2 = createBlip( -2270.4599609375, -155.95703125, 24, 54 ) blip3 = createBlip( 2229.6298828125, -1721.6298828125, 44, 54 ) setElementInterior(marker1, 7) setElementInterior(marker2, 5) setElementInterior(marker3, 6) GUIEditor = { gridlist = {}, window = {}, button = {}, memo = {} --scrollbar = {} } local screenW, screenH = guiGetScreenSize() GUIEditor.window[1] = guiCreateWindow((screenW - 678) / 2, (screenH - 695) / 2, 678, 695, "Set Your Walking Style", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(9, 23, 659, 355, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Walking Styles", 0.9) local armed = guiGridListAddRow(GUIEditor.gridlist[1], "Armed") local blind = guiGridListAddRow(GUIEditor.gridlist[1], "Blind Man") local busy = guiGridListAddRow(GUIEditor.gridlist[1], "Busy Women") local default = guiGridListAddRow(GUIEditor.gridlist[1], "Default") local drunk = guiGridListAddRow(GUIEditor.gridlist[1], "Drunk Man") local fat = guiGridListAddRow(GUIEditor.gridlist[1], "Fat Man") local fatw = guiGridListAddRow(GUIEditor.gridlist[1], "Fat Woman") local g1 = guiGridListAddRow(GUIEditor.gridlist[1], "Gang 1") local g2 = guiGridListAddRow(GUIEditor.gridlist[1], "Gang 2") local jp = guiGridListAddRow(GUIEditor.gridlist[1], "Jetpack") local other = guiGridListAddRow(GUIEditor.gridlist[1], "Sneak") local jogg = guiGridListAddRow(GUIEditor.gridlist[1], "Jogger") local men = guiGridListAddRow(GUIEditor.gridlist[1], "Men") local ofm = guiGridListAddRow(GUIEditor.gridlist[1], "Old FatMan") local ofw = guiGridListAddRow(GUIEditor.gridlist[1], "Old FatWomen") local pyr = guiGridListAddRow(GUIEditor.gridlist[1], "Player") local pyr2 = guiGridListAddRow(GUIEditor.gridlist[1], "Player 2") local pro = guiGridListAddRow(GUIEditor.gridlist[1], "Pro") local swt = guiGridListAddRow(GUIEditor.gridlist[1], "SWAT") local swmn = guiGridListAddRow(GUIEditor.gridlist[1], "Sexy Women") local shp = guiGridListAddRow(GUIEditor.gridlist[1], "Shopping") local shf = guiGridListAddRow(GUIEditor.gridlist[1], "Shuffle") local wmn = guiGridListAddRow(GUIEditor.gridlist[1], "Woman") --[[guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "Armed", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "Blind Man", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 2, 1, "Busy Woman", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 3, 1, "Default", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 4, 1, "Drunk Man", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 5, 1, "Fat Man", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 6, 1, "Fat Woman", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 7, 1, "Gang 1", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 8, 1, "Gang 2", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 9, 1, "Jetpack", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 10, 1, "Jogger", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 11, 1, "Men", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 12, 1, "Old FatMan", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 13, 1, "Old FatWoman", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 14, 1, "Player", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 15, 1, "Player 2", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 16, 1, "Pro", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 17, 1, "SWAT", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 18, 1, "Sexy Woman", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 19, 1, "Shopping", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 20, 1, "Shuffle", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 21, 1, "Sneak", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 22, 1, "Woman", false, false) ]] guiSetAlpha(GUIEditor.gridlist[1], 0.75) GUIEditor.memo[1] = guiCreateMemo(0, 389, 659, 200, "Walking style, choose one from the list and click accept, here you go you got it!\nThere's About 23 Walking Styles, choose one and ROCK!\nEnjoy!\nMade by Chris!i!", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(9, 599, 331, 86, "ACCEPT", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], font) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(342, 599, 326, 86, "CLOSE", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], font) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") guiMemoSetReadOnly ( GUIEditor.memo[1], true ) guiSetFont(GUIEditor.gridlist[1], font) function setGUIVisible(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(GUIEditor.window[1]) then guiSetVisible(GUIEditor.window[1], true) showCursor(true) end end end addEventHandler ( "onClientMarkerHit", marker1, setGUIVisible ) addEventHandler ( "onClientMarkerHit", marker2, setGUIVisible ) addEventHandler ( "onClientMarkerHit", marker3, setGUIVisible ) function closeGUI () if source == GUIEditor.button[2] then guiSetVisible ( GUIEditor.window[1], false ) showCursor ( false ) end end addEventHandler ( "onClientGUIClick", GUIEditor.button[2], closeGUI ) function dontAppearOnStart () guiSetVisible ( GUIEditor.window[1], false ) showCursor (false) end addEventHandler ( "onClientResourceStart", getRootElement(), dontAppearOnStart ) function selectGridList () local id = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) if id == "Armed" then setPedWalkingStyle ( player, 60 ) elseif id == "Blind Man" then setPedWalkingStyle ( player, 127 ) elseif id == "Busy Women" then setPedWalkingStyle ( player, 69 ) elseif id == "Default" then setPedWalkingStyle ( player, 0 ) elseif id == "Drunk Man" then setPedWalkingStyle ( player, 126 ) elseif id == "Fat Man" then setPedWalkingStyle ( player, 124 ) elseif id == "Fat Woman" then setPedWalkingStyle ( player, 135 ) elseif id == "Gang 1" then setPedWalkingStyle ( player, 121 ) elseif id == "Gang 2" then setPedWalkingStyle ( player, 122 ) elseif id == "Jetpack" then setPedWalkingStyle ( player, 70 ) elseif id == "Sneak" then setPedWalkingStyle ( player, 69 ) elseif id == "Jogger" then setPedWalkingStyle ( player, 125 ) elseif id == "Men" then setPedWalkingStyle ( player, 118 ) elseif id == "Old FatMan" then setPedWalkingStyle ( player, 123 ) elseif id == "Old FatWomen" then setPedWalkingStyle ( player, 137 ) elseif id == "Player" then setPedWalkingStyle ( player, 54 ) end end addEventHandler ( "onClientGUIClick", GUIEditor.button[1], selectGridList, false )
-
Post your code.
-
If you want the vehicle to move with a constant speed then the following resource can help you. https://community.multitheftauto.com/ind ... ils&id=989 (cruisecontrol2 -- Varez/dzek)
-
Wow, really? Which functions would I have to use? The simplest way I can think of is by using tables/arrays and element data, I can't tell the exact functions, but there are ways of adding additional vehicles and weapons without having to modify client files, just simply using the model number and adding a custom integer to check and compare values would allow to have you multiple of the same element with different properties. That is bit confusing for me. Could you(or anyone) please provide an example code for it?
-
Okay. But what are these co-ordinates? If { -0.196, 0.981, -0.000 } is player's position(x,y,z) then what are others? rotations? velocities? I mean matrix is consist of 4 sets of x,y,z's and I find it hard to understand what it is actually.
-
Oh yeah, I got it. What would be the outcome if we use '+' instead of '*'? As if I understand correctly '* 4* would get position 4 blocks in front of the player then what would '+4' do? Whose coordination's are these? Player's position,rotation or something?
-
If you also make resources/scripts for free then that's other story....
-
setElementData resets whenever you reconnect. You have to use setAccountData.
-
Anyone may please explain?
-
How can we possibly know whats wrong with it? The error you posted is telling something is wrong with one of the variables in line 140. guiGridListSetItemText( mainW.warrantTable, row, mainW.charCol, warrants[ i ][ 1 ]:gsub( "_", " " ), false, false ) -- Something is wrong with mainW.warrantTable, row, mainW.charCol or warrants[ i ][ 1 ] You have to post the full code of client side and same for the close button.
-
function depoistMoney() local text = guiGetText(GUIEditor.label[2]) local text2 = guiGetText(GUIEditor.edit[2]) if (guiRadioButtonGetSelected(GUIEditor.radiobutton[1])) then if tonumber(text) and getPlayerMoney() >= tonumber(text) and tonumber(text) >= 0 then guiSetText(cashLabel,"Transferring...") setTimer(guiSetText,2000,1,cashLabel,tostring(text + text2)) setTimer(takePlayerMoney,2000,1,tonumber(text)) setElementData(localPlayer,"bank.money",tonumber(text + text2)) elseif getPlayerMoney() == 0 then -- outputChatBox("You don't have enough money.") elseif getPlayerMoney() < 0 then outputChatBox("You can't deposit negative numbers.") end end end
