Jump to content

ViPeR124

Members
  • Posts

    10
  • Joined

  • Last visited

ViPeR124's Achievements

Member

Member (5/54)

0

Reputation

  1. Hey guys it's me again with a new problem. I want to give every player after 10 minutes 700$. So i used a timer(Server-side): setTimer( giveCash, 600000, 0) the giveCash function(Server-side): function giveCash( playerSource, cmdtext, amount ) amount = money + 700 givePlayerMoney ( playerSource, tonumber(amount) ) end Now when i am joining the server the console shows up the error: Bad argument @ 'givePlayerMoney' But when i use a command Handler it works perfectly... Someone knows what my problem is?
  2. no it's not because of the IT only the I is written in a capital letter not the t...
  3. Okay I solved the Problem. I used the Item ID and it is working Perfectly. function chooseVehicle( button ) local theItemID = guiComboBoxGetSelected(GUIEditor.combobox[2]) if theItemID == 0 then triggerServerEvent ( "admiral", localPlayer) else outputChatBox('Something went wrong!') end showCursor(false) guiSetVisible(GUIEditor.window[1], false) end
  4. hmm ok i will try to create a gui with the guieditor. Maybe it will fix my problem
  5. This is not working at all. I think the problem is in this code: function chooseVehicle( button ) local theItem = guiComboBoxGetSelected(cbmVeh2) local theText = guiComboBoxGetItemText(cbmVeh2, theITem) if theText == 'Admiral' then triggerServerEvent ( "admiral", localPlayer) else outputChatBox('It is not working!') end showCursor(false) guiSetVisible(wdwVeh, false) end Because it seems that the result of if theText == 'Admiral' then returns a false. But i don't know why
  6. function admiral() local sx, sy ,sz = getElementPosition(PlayerSource) local name = getPlayerName(source) local veh = createVehicle(445, sx, sy, sz, 0, 0 ,90, name) warpPedIntoVehicle(source, veh) end Thats the admiral event
  7. ok my mistake it is not working ._. I copied the triggerServerEvent under the else... function chooseVehicle( button ) local theItem = guiComboBoxGetSelected(cbmVeh2) local theText = guiComboBoxGetItemText(cbmVeh2, theITem) if theText == 'Admiral' then triggerServerEvent ( "admiral", localPlayer) else outputChatBox('It is not working!') end showCursor(false) guiSetVisible(wdwVeh, false) end Thats the new code and it is not working at all. I don't know what to do ...
  8. thank you Dealman for the quick reply! It's working now. Thank you very much!
  9. Hey guys, I'm new in scripting for mta but i have some know how in LUA. Only one little function in my script is not working well. I created a gui with a ComboBox and a Button. In the ComboBox i added the item 'Admiral'. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () wdwVeh = guiCreateWindow(32, 245, 264, 495, "Auto aus wählen:", false) cbmVeh = guiCreateComboBox(427, 80, 0, 15, "", false, wdwVeh) cbmVeh2 = guiCreateComboBox(10, 24, 244, 423, "", false, wdwVeh) guiComboBoxAddItem(cbmVeh2, "Admiral") btnVeh = guiCreateButton(172, 457, 82, 28, "Wählen", false, wdwVeh) guiSetVisible(wdwVeh, false) addEventHandler("onClientGUIClick", btnVeh, chooseVehicle, button ) end ) The gui is working. Everything shows up when i press 'x' (bindkey). But i have added a function to the ButtonClick event which is called "chooseVehicle" function chooseVehicle( button ) local text = guiComboBoxGetSelected(cbmVeh2) if text == "Admiral" then triggerServerEvent ( "cbmVeh", localPlayer) else outputChatBox("It's not working :C") end showCursor(false) guiSetVisible(wdwVeh, false) end so and in this part of my code i have a problem. if the selected item is "admiral" then I want to spawn an Admiral but it ever shows the 'It's not working :C' but i don't know why. If I try this: outputChatBox(''..text..'') it shows the Admiral in the chat. So is someone there who knows where the problem is? And sorry for my bad english i'm German Greets
×
×
  • Create New...