Jump to content

Forcing client


Recommended Posts

Right I want to force a player as the client for a script,

The script is a rules and FAQ window that shows when a player joins the server, with two buttons, "accept" and "decline" if accept is pressed then access to the server is granted, if decline is pressed then they are kicked from the server, displaying a message to server.

I want to add a function that when a staff member types "rules " in the console then the player will be shown the window again, but I don't know how to make it so that the 'targetPlayer' is the client.

Cheers in advance.

Link to comment
getPlayerFromNick("robhol");

No that's just how to get the player from the name, not what I was asking, I have already used that function, I need to force the player - that is returned from that function - so that the client script is active for them.

Tell me if I'm not making much sense.

Link to comment

Make a custom event for showing the window. So for example:

... 
addEvent("forceClientToSeeRules",true) 
addEventHandler("forceClientToSeeRules",getRootElement(),showRulesWindow) 
... 

And then serverside:

function forceRules(somebody, commandName, player) 
    local player=getPlayerFromName(player) 
    triggerClientEvent(player,"forceClientToSeeRules",somebody) 
end 
addCommandHandler("rules",forceRules) 

Something like that. Since I'm pretty new, you might want to double-check the code. But for the biggest part, it should do the trick. ;)

---------------------------------------------------

Response to new post posted before mine: The way I did it, somebody is the source, and player is the target. So no in the case of my example.

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