Jump to content

Some "wrong" scripts T_T


#Paper

Recommended Posts

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) 

Link to comment
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?
Link to comment
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) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...