#Paper Posted November 5, 2010 Posted November 5, 2010 Don't show any error... [color=#FF0000]Server:[/color] function shopFix( source, playeer ) local sourcename = getPlayerName(source) local drivervehicle = getPedOccupiedVehicle(source) local playerCash = loadPlayerData (source,"cash") if (tonumber(playerCash) <= 1000) then outputChatBox("You don't have enough money to fix your vehicle.",playeer,255,0,0) else fixVehicle(drivervehicle) savePlayerData (source,"cash",loadPlayerData (source,"cash") - 1000) outputChatBox( sourcename.." has fixed his vehicle for $1000!",getRootElement(),0,255,0) end end [color=#FF0000]Client:[/color] addEventHandler ( "onClientGUIClick", fix, shopFix) guiLabel: [color=#0000FF]Client:[/color] local playerCash = loadPlayerData (source,"cash") local playerPoints = loadPlayerData (source,"points") guiCreateLabel(9,150,254,15,"Cash: " ..tonumber(playerCash).. "$",false,win) guiCreateLabel(9,177,262,16,"Points: " ..tonumber(playerPoints).. "!",false,win) guiCreateLabel(9,23,269,17,"Hello, " ..getPlayerName(source).. "!",false,win)
Castillo Posted November 5, 2010 Posted November 5, 2010 i don't get a word of this, wtf is savePlayerData, loadPlayerData? custom functions?
Aibo Posted November 5, 2010 Posted November 5, 2010 probably he also copied this part from another resource and forgot the rest.
#Paper Posted November 5, 2010 Author Posted November 5, 2010 probably he also copied this part from another resource and forgot the rest. not this time...
Aibo Posted November 5, 2010 Posted November 5, 2010 probably he also copied this part from another resource and forgot the rest. not this time... whatever, this looks like different parts of code stuck toghether anyway. you can't call server function from client event, which you do in "onClientGUIClick". and why you have "source" and "playeer"? tbh, all of this hardly make any sense. and you haven't answered SolidSnake14's question: i don't get a word of this, wtf is savePlayerData, loadPlayerData? custom functions?
Beluga Posted November 6, 2010 Posted November 6, 2010 I think if this is the full code, it is definetely copied. Look like the GUI...
#Paper Posted November 6, 2010 Author Posted November 6, 2010 i don't get a word of this, wtf is savePlayerData, loadPlayerData? custom functions? it's custo functions, i'm making a gui and ranking fir PointSystem res... it's don't copied script... -.-"
Aibo Posted November 6, 2010 Posted November 6, 2010 i don't get a word of this, wtf is savePlayerData, loadPlayerData? custom functions? it's custo functions, i'm making a gui and ranking fir PointSystem res... it's don't copied script... -.-" anyway you can't call server function from client directly, you must use events: -- Server: addEvent("onShopFix", true) addEventHandler("onShopFix", getRootElement(), function() local sourcename = getPlayerName(source) local drivervehicle = getPedOccupiedVehicle(source) local playerCash = tonumber(loadPlayerData(source,"cash")) if playerCash <= 1000 then outputChatBox("You don't have enough money to fix your vehicle.",source,255,0,0) elseif not drivervehicle then outputChatBox("You are not in a vehicle.",source,255,0,0) else fixVehicle(drivervehicle) savePlayerData(source,"cash",playerCash - 1000) outputChatBox(sourcename.." has fixed his vehicle for $1000!",getRootElement(),0,255,0) end end ) -- Client: function shopFix() triggerServerEvent("onShopFix", getLocalPlayer()) end addEventHandler("onClientGUIClick", fix, shopFix)
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