Rotti Posted January 30, 2013 Share Posted January 30, 2013 Hello! I want t script a car dealer. When you buy a car you should be warped into the Vehicle. But that doesn't works... Serverside script function Faggio_buy (ThePlayer) local Faggio = createVehicle(462, -2600, 2268, setTimer(warpPedIntoVehicle, 50, 1, ThePlayer, Faggio) end function Perennial_buy (thePlayer) local Perennial = createVehicle(404, -2600, 2268, setTimer(warpPedIntoVehicle, 50, 1, ThePlayer, Perennial) end function Walton_buy (thePlayer) local Walton = createVehicle(478, -2600, 2268, setTimer(warpPedIntoVehicle, 50, 1, ThePlayer, Walton) end function Tampa_buy (thePlayer) local Tampa = createVehicle(549, -2600, 2268, setTimer(warpPedIntoVehicle, 50, 1, ThePlayer, Faggio) end addEvent("Faggio", true) addEvent("Perennial", true) addEvent("Walton", true) addEvent("Tampa", true) addEventHandler("Faggio",getRootElement (), Faggio_buy) addEventHandler("Perennial", getRootElement (), Perennial_buy) addEventHandler("Walton", getRootElement (), Walton_buy) addEventHandler("Tampa", getRootElement (), Tampa_buy) Clientside script Window = guiCreateWindow(583, 409, 197, 327, "Fake Cars", false) guiWindowSetSizable(Window, false) guiSetVisible(Window, false) Faggio = guiCreateButton(9, 96, 117, 33, "Faggio", false, Window) Perennial = guiCreateButton(9, 131, 117, 35, "Perennial", false, Window) Walton = guiCreateButton(9, 169, 118, 34, "Walton", false, Window) Tampa = guiCreateButton(9, 206, 118, 34, "Tampa", false, Window) AutoWahlenLabel = guiCreateLabel(30, 57, 139, 15, "Bitte wähle ein Auto aus", false, Window) Abbrechen = guiCreateButton(10, 288, 177, 29, "Abbrechen", false, Window) OderMochtestDu = guiCreateLabel(39, 269, 117, 15, "Oder möchtest du...", false, Window) lable1 = guiCreateLabel(131, 104, 52, 15, "500$", false, Window) guiLabelSetColor(lable1, 23, 132, 5) PerennialPreis = guiCreateLabel(131, 141, 53, 15, "2000$", false, Window) guiLabelSetColor(PerennialPreis, 23, 132, 5) WaltonPreis = guiCreateLabel(132, 181, 55, 15, "1500$", false, Window) guiLabelSetColor(WaltonPreis, 23, 132, 5) TampaPreis = guiCreateLabel(131, 218, 56, 15, "750$", false, Window) guiLabelSetColor(TampaPreis, 23, 132, 5) function Fake_Cars_show() local IsWindowVisible = guiGetVisible(Window) if (IsWindowVisible == true) then guiSetVisible(Window, false) guiSetInputEnabled(false) elseif (IsWindowVisible == false) then guiSetVisible(Window, true) guiSetInputEnabled(true) end end local myMarker = createMarker(-2615, 2262, 7.3, "cylinder", 1.0, 255, 0, 0, 150) addEventHandler("onClientMarkerHit", myMarker, function(player) if getElementType(player) == "player" and player == localPlayer then Fake_Cars_show() end end) function Buttons(state) if state == "left" then if source == Abbrechen then Fake_Cars_show() end if source == Faggio then money = getPlayerMoney() if (money > 499) then triggerServerEvent("Faggio", getRootElement() ) takePlayerMoney(500) else outputChatBox("Du hast nicht genügend Geld.") end end if source == Perennial then money = getPlayerMoney() if (money > 1999) then triggerServerEvent("Perennial", getRootElement() ) takePlayerMoney(2000) else outputChatBox("Du hast nicht genügend Geld.") end end if source == Walton then money = getPlayerMoney() if (money > 1499) then triggerServerEvent("Walton", getRootElement() ) takePlayerMoney(1500) else outputChatBox("Du hast nicht genügend Geld.") end end if source == Tampa then money = getPlayerMoney() if (money > 749) then triggerServerEvent("Tampa", getRootElement() ) takePlayerMoney(750) else outputChatBox("Du hast nicht genügend Geld.") end end end end addEventHandler("onClientGUIClick", root, Buttons) Don't worry about the :0. It's just because it should sell the Motorcycle F a g g i o. And this Website doesn't allows this word. Link to comment
csiguusz Posted January 30, 2013 Share Posted January 30, 2013 And use triggerServerEvent right use this, and use source instead of thePlayer server side: triggerServerEvent("your_event", getLocalPlayer() ) or use this so you don't need to change much on server-side just check, that if you used thePlayer as a function argument then use thePlayer in the function too, not ThePlayer. triggerServerEvent("your_event", getLocalPlayer(), getLocalPlayer() ) Link to comment
Rotti Posted January 30, 2013 Author Share Posted January 30, 2013 No... doesn't work Link to comment
Rotti Posted January 30, 2013 Author Share Posted January 30, 2013 It says lua:18 Bad argument @ 'warpPedIntoVehicle' Link to comment
Rotti Posted January 30, 2013 Author Share Posted January 30, 2013 Oh sorry, i tried the first one with source instead of thPlayer, that worked Link to comment
iPrestege Posted January 30, 2013 Share Posted January 30, 2013 Remember: when you use the function to take the money in the client side will be taking fake money in a way that if you want to be taking money to fully use the function to take the money in the server-side this was only just alert anyway your option . Link to comment
damien111 Posted January 30, 2013 Share Posted January 30, 2013 Remember: when you use the function to take the money in the client side will be taking fake money in a way that if you want to be taking money to fully use the function to take the money in the server-side this was only just alert anyway your option . Just in case you didnt understand this, you must trigger a server side event to take his money, or the money part is pointless Link to comment
iPrestege Posted January 30, 2013 Share Posted January 30, 2013 Remember: when you use the function to take the money in the client side will be taking fake money in a way that if you want to be taking money to fully use the function to take the money in the server-side this was only just alert anyway your option . Just in case you didnt understand this, you must trigger a server side event to take his money, or the money part is pointless Really?This is something new for me . Link to comment
damien111 Posted January 30, 2013 Share Posted January 30, 2013 I didnt mean for you! It was for him, he seemed to be kinda, non informed Link to comment
iPrestege Posted January 30, 2013 Share Posted January 30, 2013 I didnt mean for you! It was for him, he seemed to be kinda, non informed I know, but I was joking . Link to comment
ViRuZGamiing Posted January 31, 2013 Share Posted January 31, 2013 Rotti can you reply my PM? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now