Jump to content

{HELP} Script Errors


Recommended Posts

I've made a script to fix a car and get the player from his id. but i got some bugs.

function FixVeh (player, command, checkedPlayerName, id) 
local auto = getPedOccupiedVehicle(player) 
local prachy = getPlayerMoney(player) 
local checkedPlayer = getPlayerFromName (checkedPlayerName) 
local checkedID = exports.ID_System:getPlayerFromID(id) 
    if prachy >= 20 and isPedInVehicle (checkedPlayer,CheckedID) then 
        takePlayerMoney(player, 20) 
        outputChatBox("Your vehicle has been fixed - 20$.  You have $" ..  getPlayerMoney(player), player, 0, 255, 0) 
     
elseif isPedInVehicle (false) then 
    return outputChatBox("You're not in a car.", player, 250, 0, 0 ) 
    elseif getPlayerMoney (player, > 20) then 
    return outputChatBox ("you have no enough money to fix this car.", player, 250, 0, 0) 
end 
end 
  
addCommandHandler("fix", FixVeh)  

and the place which i export from is ID_System Folder and script which exports from is:

function getPlayerFromID ( id ) 
    for k, player in ipairs ( getElementsByType ( "player" ) ) do 
        local p_id = getElementData ( player, "ID" ) 
        if ( p_id == tonumber(id) ) then  
            player_n = getPlayerName ( player ) 
            return player, player_n 
        end 
    end 
        return false, "No player has been found with the ID " .. id .. "." 
end  

Errors

ERROR: call: faild to call 'ID_System:getPlayerFromID' [string"?"] 
WARNING:  Bad argument @ 'isPedInVehicle' 

Help Please.

Link to comment
Is the function "getPlayerFromID" exported at "ID_system"?

yes

Here

function processIDCommands ( source, command, input ) 
    if ( tonumber ( input ) ) then 
        local player, playername = getPlayerFromID ( tonumber(input) ) 
            if ( player ) then 
                outputChatBox ( "Player that matches that id: ", source, 255, 255, 0 ) 
                outputChatBox ( "(" .. input .. ") " .. playername, source, 255, 255, 0, true ) 
            else 
                outputChatBox ( playername, source, 255, 0, 0 ) -- in this case, playername carries the error. It's just to minimize the amount of code if an error is ecountered. 
            end 
    else 
        local player = getPlayer ( source, input ) 
        if ( player ) then 
            outputChatBox ( "Player that matches that id: ", source, 255, 255, 0 ) 
            outputChatBox ( "(" .. tostring ( getElementData ( player, "ID" ) ) .. ") " .. getPlayerName ( player ), source, 255, 255, 0, true ) 
        end  
    end 
end      
addCommandHandler ( "id", processIDCommands ) 

Link to comment
just look at your script if your exported functions in client then export it in client if its in server side then export it in server side

Alright and now i did it

    "Id_System" author="Scripter" version="1.0" type="script" /> 
    

Whatever i got ERROR when i tried to /pay...

:157: attempt to concatenate local 'id' (a nil value) 

and the script is

server:

local availableID = { }   -- Create the table that specifies which id's are available. 
local scoreboard 
local _dxver 
local _initp = true 
local _loaded = false 
  
function Init ()  
    if ( getResourceFromName ( "scoreboard" ) and getResourceState ( getResourceFromName ( "scoreboard" ) ) == "running" ) then 
        scoreboard = exports.scoreboard 
        _dxver = false 
    elseif ( getResourceFromName ( "dxscoreboard" ) and getResourceState ( getResourceFromName ( "dxscoreboard" ) ) == "running" ) then      
        scoreboard = exports.dxscoreboard  
        _dxver = true 
    else 
        outputDebugString ( "No scoreboard resource has been started", 2 ) 
        _initp = false 
    end  
    if _initp then 
        scoreboard:addScoreboardColumn ( "ID", getRootElement(), 1, 0.05 ) -- Add the ID column  
        sortScoreboard( "ID" ) 
    end  
    if not _loaded then 
        loadID() 
    end  
end 
addEventHandler ( "onResourceStart", resourceRoot, Init ) 
  
function loadID () 
    _loaded = true 
    local max_players = getMaxPlayers() 
    for i = 1, max_players do 
        table.insert ( availableID, i, true )  -- Populate the table. 
    end 
    for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        assignPlayerID ( player ) -- Assign an id to all players. 
    end  
end  
  
function checkStoppedResource ( resource ) 
    local rname = getResourceName ( resource ) 
    local sres = tostring ( scoreboard ):gsub( "exports.","" ) 
    if ( rname:lower() == sres:lower() ) then 
        outputChatBox ( "falsed" ) 
        _initp = false 
    end 
end 
addEventHandler ( "onResourceStop", getRootElement(), checkStoppedResource ) 
  
function checkStartedResource ( resource ) 
    if ( getResourceName ( resource ) == "scoreboard" or "dxscoreboard" and source ~= getResourceRootElement() ) then 
        Init() 
    end 
end 
addEventHandler ( "onResourceStart", getRootElement(), checkStartedResource )--]] 
  
function sortScoreboard( column ) 
    if _dxvera and _initp then 
        scoreboard:scoreboardSetSortBy ( column, true, getRootElement() ) 
    end  
end  
  
function onJoin () -- Player joined --> assign ID. 
    assignPlayerID ( source ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), onJoin)  
  
function assignPlayerID ( player ) 
    local s_id = 1 -- start at one 
    while ( isIDAvailable ( s_id ) == false ) do -- is it available? if not, +1 & repeat. 
        s_id = s_id + 1 
    end 
    setElementData ( player, "ID", s_id ) -- available -> assign the ID to the player. 
    sortScoreboard( "ID" ) 
    availableID[ s_id ] = false -- set the id as not available. 
end      
     
function isIDAvailable ( id ) -- checks if the id is used or not. 
    return availableID[id]  
end  
  
function onLeave () -- player left, remove ID, set as available. 
    local s_id = getElementData ( source, "ID" ) 
    availableID[ s_id ] = true 
    removeElementData ( source, "ID" )   
end 
addEventHandler ( "onPlayerQuit", getRootElement(), onLeave )        
  
function removeData ( ) -- resource stopped, clear everything. 
    for k, players in ipairs ( getElementsByType ( "player" )) do 
        removeElementData ( players, "ID" ) 
    end 
    availableID = { } 
end  
addEventHandler ( "onResourceStop", resourceRoot, removeData ) 
  
function getNameMatches ( player_name ) 
i = 1 
local matchingPlayers = { } 
    if ( player_name ) then 
        for k, player in ipairs ( getElementsByType ( "player" ) ) do 
            local player_n = getPlayerName ( player ) 
            local match = string.find ( string.lower( player_n ), string.lower ( player_name ) ) 
            if ( match ) then 
                table.insert ( matchingPlayers, i, player ) 
                i = i + 1 
            end 
        end 
        if ( #matchingPlayers == 1 ) then 
            return true, matchingPlayers[1]  
        elseif ( #matchingPlayers > 1 ) then 
            return true, matchingPlayers 
        else 
            return false, "None" 
        end  
    else 
        return false, "Please enter a player name" 
    end  
end      
  
function getPlayerFromPartialName ( source, player_name, script ) 
    if ( player_name ) then 
        local sucess, value = getNameMatches ( player_name ) 
            if ( sucess ) then 
                local matches = ( type ( value ) == "table" ) and #value or 1 
                if ( matches == 1 ) then 
                    if ( script ) then return value else  
                        local player_nick = getPlayerName ( value ) 
                        local player_id = getElementData ( value, "ID" ) 
                        outputChatBox ( "(" .. player_id .. ") " .. player_nick, source, 255, 255, 0 ) 
                    end  
                else     
                    outputChatBox ( "Players matching your search are: ", source, 255, 255, 0 ) 
                    for k, player in ipairs ( value ) do 
                        local player_nick = getPlayerName ( value[k] ) 
                        local player_id = getElementData ( value[k], "ID" ) 
                        outputChatBox ( "(" .. player_id .. ") " .. player_nick, source, 255, 255, 0 ) 
                    end 
                    return true, true 
                end      
            else 
                if ( script ) then return false else 
                    outputChatBox ( "Players matching your search are: ", source, 255, 255, 0 ) 
                    outputChatBox ( value, source, 255, 0, 0 ) 
                end  
            end 
    end 
end  
  
function getPlayerFromID ( id ) 
    for k, player in ipairs ( getElementsByType ( "player" ) ) do 
        local p_id = getElementData ( player, "ID" ) 
        if ( p_id == tonumber(id) ) then  
            player_n = getPlayerName ( player ) 
            return player, player_n 
        end 
    end 
        return false, "No player has been found with the ID " .. id .. "." 
end  
  
function getPlayer ( source, input ) 
    if ( tonumber ( input ) ) then 
        local player, playername = getPlayerFromID ( tonumber(input) ) 
        if ( player ) then 
            return player 
        else 
            outputChatBox ( playername, source, 255, 0, 0 ) -- in this case, playername carries the error. It's just to minimize the amount of code if an error is ecountered. 
            return false 
        end 
    else 
        local player, multiple = getPlayerFromPartialName ( source, input, true ) 
        if ( player and not multiple ) then 
            return player 
        elseif ( player and multiple ) then 
            return false     
        else 
            outputChatBox ( "Player not found", source, 255, 0, 0 ) 
            return false 
        end 
    end 
end 
  
function processIDCommands ( source, command, input ) 
    if ( tonumber ( input ) ) then 
        local player, playername = getPlayerFromID ( tonumber(input) ) 
            if ( player ) then 
                outputChatBox ( "Player that matches that id: ", source, 255, 255, 0 ) 
                outputChatBox ( "(" .. input .. ") " .. playername, source, 255, 255, 0, true ) 
            else 
                outputChatBox ( playername, source, 255, 0, 0 ) -- in this case, playername carries the error. It's just to minimize the amount of code if an error is ecountered. 
            end 
    else 
        local player = getPlayer ( source, input ) 
        if ( player ) then 
            outputChatBox ( "Player that matches that id: ", source, 255, 255, 0 ) 
            outputChatBox ( "(" .. tostring ( getElementData ( player, "ID" ) ) .. ") " .. getPlayerName ( player ), source, 255, 255, 0, true ) 
        end  
    end 
end      
addCommandHandler ( "id", processIDCommands ) 

Link to comment
try adding line 157 "No player has been found with the ID " .. id .. "." to outputChatBox

Still the same Problem and the script now is:

local availableID = { }   -- Create the table that specifies which id's are available. 
local scoreboard 
local _dxver 
local _initp = true 
local _loaded = false 
  
function Init ()  
    if ( getResourceFromName ( "scoreboard" ) and getResourceState ( getResourceFromName ( "scoreboard" ) ) == "running" ) then 
        scoreboard = exports.scoreboard 
        _dxver = false 
    elseif ( getResourceFromName ( "dxscoreboard" ) and getResourceState ( getResourceFromName ( "dxscoreboard" ) ) == "running" ) then      
        scoreboard = exports.dxscoreboard  
        _dxver = true 
    else 
        outputDebugString ( "No scoreboard resource has been started", 2 ) 
        _initp = false 
    end  
    if _initp then 
        scoreboard:addScoreboardColumn ( "ID", getRootElement(), 1, 0.05 ) -- Add the ID column  
        sortScoreboard( "ID" ) 
    end  
    if not _loaded then 
        loadID() 
    end  
end 
addEventHandler ( "onResourceStart", resourceRoot, Init ) 
  
function loadID () 
    _loaded = true 
    local max_players = getMaxPlayers() 
    for i = 1, max_players do 
        table.insert ( availableID, i, true )  -- Populate the table. 
    end 
    for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        assignPlayerID ( player ) -- Assign an id to all players. 
    end  
end  
  
function checkStoppedResource ( resource ) 
    local rname = getResourceName ( resource ) 
    local sres = tostring ( scoreboard ):gsub( "exports.","" ) 
    if ( rname:lower() == sres:lower() ) then 
        outputChatBox ( "falsed" ) 
        _initp = false 
    end 
end 
addEventHandler ( "onResourceStop", getRootElement(), checkStoppedResource ) 
  
function checkStartedResource ( resource ) 
    if ( getResourceName ( resource ) == "scoreboard" or "dxscoreboard" and source ~= getResourceRootElement() ) then 
        Init() 
    end 
end 
addEventHandler ( "onResourceStart", getRootElement(), checkStartedResource )--]] 
  
function sortScoreboard( column ) 
    if _dxvera and _initp then 
        scoreboard:scoreboardSetSortBy ( column, true, getRootElement() ) 
    end  
end  
  
function onJoin () -- Player joined --> assign ID. 
    assignPlayerID ( source ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), onJoin)  
  
function assignPlayerID ( player ) 
    local s_id = 1 -- start at one 
    while ( isIDAvailable ( s_id ) == false ) do -- is it available? if not, +1 & repeat. 
        s_id = s_id + 1 
    end 
    setElementData ( player, "ID", s_id ) -- available -> assign the ID to the player. 
    sortScoreboard( "ID" ) 
    availableID[ s_id ] = false -- set the id as not available. 
end      
     
function isIDAvailable ( id ) -- checks if the id is used or not. 
    return availableID[id]  
end  
  
function onLeave () -- player left, remove ID, set as available. 
    local s_id = getElementData ( source, "ID" ) 
    availableID[ s_id ] = true 
    removeElementData ( source, "ID" )   
end 
addEventHandler ( "onPlayerQuit", getRootElement(), onLeave )        
  
function removeData ( ) -- resource stopped, clear everything. 
    for k, players in ipairs ( getElementsByType ( "player" )) do 
        removeElementData ( players, "ID" ) 
    end 
    availableID = { } 
end  
addEventHandler ( "onResourceStop", resourceRoot, removeData ) 
  
function getNameMatches ( player_name ) 
i = 1 
local matchingPlayers = { } 
    if ( player_name ) then 
        for k, player in ipairs ( getElementsByType ( "player" ) ) do 
            local player_n = getPlayerName ( player ) 
            local match = string.find ( string.lower( player_n ), string.lower ( player_name ) ) 
            if ( match ) then 
                table.insert ( matchingPlayers, i, player ) 
                i = i + 1 
            end 
        end 
        if ( #matchingPlayers == 1 ) then 
            return true, matchingPlayers[1]  
        elseif ( #matchingPlayers > 1 ) then 
            return true, matchingPlayers 
        else 
            return false, "None" 
        end  
    else 
        return false, "Please enter a player name" 
    end  
end      
  
function getPlayerFromPartialName ( source, player_name, script ) 
    if ( player_name ) then 
        local sucess, value = getNameMatches ( player_name ) 
            if ( sucess ) then 
                local matches = ( type ( value ) == "table" ) and #value or 1 
                if ( matches == 1 ) then 
                    if ( script ) then return value else  
                        local player_nick = getPlayerName ( value ) 
                        local player_id = getElementData ( value, "ID" ) 
                        outputChatBox ( "(" .. player_id .. ") " .. player_nick, source, 255, 255, 0 ) 
                    end  
                else     
                    outputChatBox ( "Players matching your search are: ", source, 255, 255, 0 ) 
                    for k, player in ipairs ( value ) do 
                        local player_nick = getPlayerName ( value[k] ) 
                        local player_id = getElementData ( value[k], "ID" ) 
                        outputChatBox ( "(" .. player_id .. ") " .. player_nick, source, 255, 255, 0 ) 
                    end 
                    return true, true 
                end      
            else 
                if ( script ) then return false else 
                    outputChatBox ( "Players matching your search are: ", source, 255, 255, 0 ) 
                    outputChatBox ( value, source, 255, 0, 0 ) 
                end  
            end 
    end 
end  
  
function getPlayerFromID ( id ) 
    for k, player in ipairs ( getElementsByType ( "player" ) ) do 
        local p_id = getElementData ( player, "ID" ) 
        if ( p_id == tonumber(id) ) then  
            player_n = getPlayerName ( player ) 
            return player, player_n 
        end 
    end 
        return false, outputChatBox ("No player has been found with the ID " .. id .. ".") 
end  
  
function getPlayer ( source, input ) 
    if ( tonumber ( input ) ) then 
        local player, playername = getPlayerFromID ( tonumber(input) ) 
        if ( player ) then 
            return player 
        else 
            outputChatBox ( playername, source, 255, 0, 0 ) -- in this case, playername carries the error. It's just to minimize the amount of code if an error is ecountered. 
            return false 
        end 
    else 
        local player, multiple = getPlayerFromPartialName ( source, input, true ) 
        if ( player and not multiple ) then 
            return player 
        elseif ( player and multiple ) then 
            return false     
        else 
            outputChatBox ( "Player not found", source, 255, 0, 0 ) 
            return false 
        end 
    end 
end 
  
function processIDCommands ( source, command, input ) 
    if ( tonumber ( input ) ) then 
        local player, playername = getPlayerFromID ( tonumber(input) ) 
            if ( player ) then 
                outputChatBox ( "Player that matches that id: ", source, 255, 255, 0 ) 
                outputChatBox ( "(" .. input .. ") " .. playername, source, 255, 255, 0, true ) 
            else 
                outputChatBox ( playername, source, 255, 0, 0 ) -- in this case, playername carries the error. It's just to minimize the amount of code if an error is ecountered. 
            end 
    else 
        local player = getPlayer ( source, input ) 
        if ( player ) then 
            outputChatBox ( "Player that matches that id: ", source, 255, 255, 0 ) 
            outputChatBox ( "(" .. tostring ( getElementData ( player, "ID" ) ) .. ") " .. getPlayerName ( player ), source, 255, 255, 0, true ) 
        end  
    end 
end      
addCommandHandler ( "id", processIDCommands ) 

Link to comment
remove that "." and put true instead

Yea Alright i did it but when i try to test the pay with myself like /fix 1

it says:

No player has been found with the ID .. id .. 

in the chat box

and the script now is:

local availableID = { }   -- Create the table that specifies which id's are available. 
local scoreboard 
local _dxver 
local _initp = true 
local _loaded = false 
  
function Init ()  
    if ( getResourceFromName ( "scoreboard" ) and getResourceState ( getResourceFromName ( "scoreboard" ) ) == "running" ) then 
        scoreboard = exports.scoreboard 
        _dxver = false 
    elseif ( getResourceFromName ( "dxscoreboard" ) and getResourceState ( getResourceFromName ( "dxscoreboard" ) ) == "running" ) then      
        scoreboard = exports.dxscoreboard  
        _dxver = true 
    else 
        outputDebugString ( "No scoreboard resource has been started", 2 ) 
        _initp = false 
    end  
    if _initp then 
        scoreboard:addScoreboardColumn ( "ID", getRootElement(), 1, 0.05 ) -- Add the ID column  
        sortScoreboard( "ID" ) 
    end  
    if not _loaded then 
        loadID() 
    end  
end 
addEventHandler ( "onResourceStart", resourceRoot, Init ) 
  
function loadID () 
    _loaded = true 
    local max_players = getMaxPlayers() 
    for i = 1, max_players do 
        table.insert ( availableID, i, true )  -- Populate the table. 
    end 
    for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        assignPlayerID ( player ) -- Assign an id to all players. 
    end  
end  
  
function checkStoppedResource ( resource ) 
    local rname = getResourceName ( resource ) 
    local sres = tostring ( scoreboard ):gsub( "exports.","" ) 
    if ( rname:lower() == sres:lower() ) then 
        outputChatBox ( "falsed" ) 
        _initp = false 
    end 
end 
addEventHandler ( "onResourceStop", getRootElement(), checkStoppedResource ) 
  
function checkStartedResource ( resource ) 
    if ( getResourceName ( resource ) == "scoreboard" or "dxscoreboard" and source ~= getResourceRootElement() ) then 
        Init() 
    end 
end 
addEventHandler ( "onResourceStart", getRootElement(), checkStartedResource )--]] 
  
function sortScoreboard( column ) 
    if _dxvera and _initp then 
        scoreboard:scoreboardSetSortBy ( column, true, getRootElement() ) 
    end  
end  
  
function onJoin () -- Player joined --> assign ID. 
    assignPlayerID ( source ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), onJoin)  
  
function assignPlayerID ( player ) 
    local s_id = 1 -- start at one 
    while ( isIDAvailable ( s_id ) == false ) do -- is it available? if not, +1 & repeat. 
        s_id = s_id + 1 
    end 
    setElementData ( player, "ID", s_id ) -- available -> assign the ID to the player. 
    sortScoreboard( "ID" ) 
    availableID[ s_id ] = false -- set the id as not available. 
end      
     
function isIDAvailable ( id ) -- checks if the id is used or not. 
    return availableID[id]  
end  
  
function onLeave () -- player left, remove ID, set as available. 
    local s_id = getElementData ( source, "ID" ) 
    availableID[ s_id ] = true 
    removeElementData ( source, "ID" )   
end 
addEventHandler ( "onPlayerQuit", getRootElement(), onLeave )        
  
function removeData ( ) -- resource stopped, clear everything. 
    for k, players in ipairs ( getElementsByType ( "player" )) do 
        removeElementData ( players, "ID" ) 
    end 
    availableID = { } 
end  
addEventHandler ( "onResourceStop", resourceRoot, removeData ) 
  
function getNameMatches ( player_name ) 
i = 1 
local matchingPlayers = { } 
    if ( player_name ) then 
        for k, player in ipairs ( getElementsByType ( "player" ) ) do 
            local player_n = getPlayerName ( player ) 
            local match = string.find ( string.lower( player_n ), string.lower ( player_name ) ) 
            if ( match ) then 
                table.insert ( matchingPlayers, i, player ) 
                i = i + 1 
            end 
        end 
        if ( #matchingPlayers == 1 ) then 
            return true, matchingPlayers[1]  
        elseif ( #matchingPlayers > 1 ) then 
            return true, matchingPlayers 
        else 
            return false, "None" 
        end  
    else 
        return false, "Please enter a player name" 
    end  
end      
  
function getPlayerFromPartialName ( source, player_name, script ) 
    if ( player_name ) then 
        local sucess, value = getNameMatches ( player_name ) 
            if ( sucess ) then 
                local matches = ( type ( value ) == "table" ) and #value or 1 
                if ( matches == 1 ) then 
                    if ( script ) then return value else  
                        local player_nick = getPlayerName ( value ) 
                        local player_id = getElementData ( value, "ID" ) 
                        outputChatBox ( "(" .. player_id .. ") " .. player_nick, source, 255, 255, 0 ) 
                    end  
                else     
                    outputChatBox ( "Players matching your search are: ", source, 255, 255, 0 ) 
                    for k, player in ipairs ( value ) do 
                        local player_nick = getPlayerName ( value[k] ) 
                        local player_id = getElementData ( value[k], "ID" ) 
                        outputChatBox ( "(" .. player_id .. ") " .. player_nick, source, 255, 255, 0 ) 
                    end 
                    return true, true 
                end      
            else 
                if ( script ) then return false else 
                    outputChatBox ( "Players matching your search are: ", source, 255, 255, 0 ) 
                    outputChatBox ( value, source, 255, 0, 0 ) 
                end  
            end 
    end 
end  
  
function getPlayerFromID ( id ) 
    for k, player in ipairs ( getElementsByType ( "player" ) ) do 
        local p_id = getElementData ( player, "ID" ) 
        if ( p_id == tonumber(id) ) then  
            player_n = getPlayerName ( player ) 
            return player, player_n 
        end 
    end 
        return false, outputChatBox ("No player has been found with the ID .. id ..") 
end  
  
function getPlayer ( source, input ) 
    if ( tonumber ( input ) ) then 
        local player, playername = getPlayerFromID ( tonumber(input) ) 
        if ( player ) then 
            return player 
        else 
            outputChatBox ( playername, source, 255, 0, 0 ) -- in this case, playername carries the error. It's just to minimize the amount of code if an error is ecountered. 
            return false 
        end 
    else 
        local player, multiple = getPlayerFromPartialName ( source, input, true ) 
        if ( player and not multiple ) then 
            return player 
        elseif ( player and multiple ) then 
            return false     
        else 
            outputChatBox ( "Player not found", source, 255, 0, 0 ) 
            return false 
        end 
    end 
end 
  
function processIDCommands ( source, command, input ) 
    if ( tonumber ( input ) ) then 
        local player, playername = getPlayerFromID ( tonumber(input) ) 
            if ( player ) then 
                outputChatBox ( "Player that matches that id: ", source, 255, 255, 0 ) 
                outputChatBox ( "(" .. input .. ") " .. playername, source, 255, 255, 0, true ) 
            else 
                outputChatBox ( playername, source, 255, 0, 0 ) -- in this case, playername carries the error. It's just to minimize the amount of code if an error is ecountered. 
            end 
    else 
        local player = getPlayer ( source, input ) 
        if ( player ) then 
            outputChatBox ( "Player that matches that id: ", source, 255, 255, 0 ) 
            outputChatBox ( "(" .. tostring ( getElementData ( player, "ID" ) ) .. ") " .. getPlayerName ( player ), source, 255, 255, 0, true ) 
        end  
    end 
end      
addCommandHandler ( "id", processIDCommands ) 

Edited by Guest
Link to comment

and Error here too:

    function FixVeh (player, command, checkedPlayerName, id) 
    local auto = getPedOccupiedVehicle(player) 
    local prachy = getPlayerMoney(player) 
    local checkedPlayer = getPlayerFromName (checkedPlayerName) 
    local checkedID = exports.ID_System:getPlayerFromID(id) 
        if prachy >= 20 and isPedInVehicle (checkedPlayer,CheckedID) then 
            takePlayerMoney(player, 20) 
            outputChatBox("Your vehicle has been fixed - 20$.  You have $" ..  getPlayerMoney(player), player, 0, 255, 0) 
        
    elseif isPedInVehicle (false) then 
        return outputChatBox("You're not in a car.", player, 250, 0, 0 ) 
        elseif getPlayerMoney (player, > 20) then 
        return outputChatBox ("you have no enough money to fix this car.", player, 250, 0, 0) 
    end 
    end 
      
    addCommandHandler("fix", FixVeh)  

:12: unexpected symbol near '>' 

Link to comment
  • 3 months later...

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...