Jump to content

TriggerServerEvent


SkatCh

Recommended Posts

hi guys i'm doing my best to learn lua language but some time i need some help that's why i'm here i have a simple question .

i create some special title for members let's say if your account name is 'xxxxxxx' you will get a special title . so i need to use getAccountName in this case i need to triggerServerEvent right . this my client side just a part from my script :

function specialTitles(accountName) 
  guiGridListClear(grid_titles) 
  triggerServerEvent (......) <------- i think that i need to put the TriggerServerEvent here to check the Account name 
  if accountName == "xxxxxxx" then 
    titlesTable["xxxxxxxxx"] = true 
  end 
end 
addEvent("Special", true) 
addEventHandler("Special", root, specialTitles) 

So my question is how can i add a function on the server side to check the player account name , sorry i'm not good enough with Trigger events , really i don't know how to use it .

im sorry about my english

Link to comment
You could use setElementData in the onPlayerLogin event. You can set the group for example "AccountName" and then the value equal to their account name, then on the client side you can use getElementDatato get their account name.

bro i think you don't undrestand my question i will explane to you my idea , i create Table with some titles everyone can use them and now i'm thinking to create a special title for certain Players example your accountName is 'xXMADEXx' you will see a new title but other player can't see it , my script is working fine just i need to create some thing in server side to check player name because i can't use getAccountName in client side so that's why i need TriggerServerEvent did you undrestand my idea example i create this but it did work related to the first part :

server

function walking(AccountName, localPlayer) 
     local accountName = getAccountName(localPlayer) 
    if accountName then  
triggerClientEvent ("Special" , localPlayer, AccountName) 
end 
addEvent("On.tit", true) 
addEventHandler("On.tit",root,walking) 

client

function specialTitles(accountName) 
  guiGridListClear(grid_titles) 
  triggerServerEvent ("On.tit",localPlayer,acountName) <------- i think that i need to put the TriggerServerEvent here to check the Account name 
  if accountName == "xXMADEXx" then 
    titlesTable["Pro member"] = true 
  end 
end 
addEvent("Special", true) 
addEventHandler("Special", root, specialTitles) 

Link to comment
    function walking() 
         local accountName = getAccountName(getPlayerAccount(source)) 
        if accountName then 
    triggerClientEvent ("Special" , source, AccountName) 
    end 
    addEvent("On.tit", true) 
    addEventHandler("On.tit",root,walking) 

function a() 
      guiGridListClear(grid_titles) 
      triggerServerEvent ("On.tit",localPlayer) 
end 
function specialTitles(accountName) 
      if accountName == "xXMADEXx" then 
        titlesTable["Pro member"] = true 
      end 
    end 
addEvent("Special", true) 
addEventHandler("Special", root, specialTitles) 

Link to comment
    function walking() 
         local accountName = getAccountName(getPlayerAccount(source)) 
        if accountName then 
    triggerClientEvent ("Special" , source, AccountName) 
    end 
 end -- forgot this 
    addEvent("On.tit", true) 
    addEventHandler("On.tit",root,walking) 

function a() 
      guiGridListClear(grid_titles) 
      triggerServerEvent ("On.tit",localPlayer) 
end 
function specialTitles(accountName) 
      if accountName == "xXMADEXx" then 
        titlesTable["Pro member"] = true 
      end 
    end 
addEvent("Special", true) 
addEventHandler("Special", root, specialTitles) 

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