Jump to content

Executing Server Functions on the Client Side with a Return Value


Swimer

Recommended Posts

I need to get the result of a server function from an event handler.

local plTeam = getPlayerTeam(localPlayer)
if plTeam then
  if isPlayerInTeam(plr, plTeam) then
    local friend = getPlayerFriend(plr) -- Execute server-side function "getPlayerFriend(player)"
    text = friend.." ["..id.."]"
  end
end

 

Edited by Swimer
Changed the code to be more clear
Link to comment
  • Scripting Moderators
4 hours ago, Swimer said:

I need to get the result of a server function from an event handler.

local plTeam = getPlayerTeam(localPlayer)
if plTeam then
  if isPlayerInTeam(plr, plTeam) then
    local friend = getPlayerFriend(plr) -- Execute server-side function "getPlayerFriend(player)"
    text = friend.." ["..id.."]"
  end
end

 

Try this, but carefully read full page. Might require some changes though.

https://wiki.multitheftauto.com/wiki/CallServerFunction

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