SkatCh

Members
  • Content Count

    366
  • Joined

  • Last visited

Posts posted by SkatCh


  1. yes bro me too i think it's right but i try didn't work can you fix it please:

    addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), 
    function () 
    for i, p in ipairs ( getElementsByType ( "player" ) ) do 
    local account = getPlayerAccount (p) 
    if ( getAccountName ( account ) ) then  <------------- this line 
    if ( getAccountData ( getAccountName ( p ), "vip" ) ) then 
    setElementData ( p, "vip", true ); 
    setElementData ( p, "vip.time", tonumber ( getAccountData ( getAccountName ( p ), "vip.time" ) ) ); 
    startVip ( p ); 
    end 
    end 
    end 
    end 
    ); 
    


  2. hi guys please i need some help here i create a vip system and i got some warinings here : just i want when i restart the resource evrey one will get his VIP status :

      
    addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), 
    function () 
    for i, p in ipairs ( getElementsByType ( "player" ) ) do 
    if ( getAccountName ( p ) ) then  <------------- this line 
    if ( getAccountData ( getAccountName ( p ), "vip" ) ) then 
    setElementData ( p, "vip", true ); 
    setElementData ( p, "vip.time", tonumber ( getAccountData ( getAccountName ( p ), "vip.time" ) ) ); 
    startVip ( p ); 
    end 
    end 
    end 
    end 
    ); 
    

    Warning : bad argument @ 'getAccountName' [expected account at argument 1 , got player]


  3. no one will create something like that for free , you can use those function :

    "getTeamName"

    "getPlayerTeam"

    "onClientPlayerDamage"

    etc ...

    i will make it easy for you , example army can't kill swat.

      
    addEventHandler( "onClientPlayerDamage", root, 
    function ( theAttacker ) 
        if ( isElement( source ) ) and ( isElement( theAttacker ) ) then --- check if is element ... 
            if ( getElementType(theAttacker) == "player" ) then 
    if ( getTeamName( getPlayerTeam( theAttacker ) ) == "Army" ) and ( getTeamName( getPlayerTeam( source ) ) == "SWAT" ) then --- check teams  
                           cancelEvent() 
                        end 
      
    


  4. hi guys please i need some help i'm trying to create a speed control system but i think that i have some thing wrong.

    just a part from my script :

    function speedCam( thePlayer ) 
    local level = getPlayerWantedLevel ( thePlayer ) <--- this line 
    local veh = getPlayerOccupiedVehicle( thePlayer ) <--- and this 
    local fine = math.random(50,100) 
    if (getElementSpeed(veh,"kph") > 140) and (getPlayerMoney( thePlayer ) > (fine)) then 
    takePlayerMoney(thePlayer,fine) 
    outputChatBox("A Speed Cam has captured you driving on "..(math.floor(getElementSpeed(veh))).."KM/H, A fine of $"..fine.." has been taken from you.(LIMIT:140KM/H)",thePlayer,255,255,255) 
    

    warnings :

    bad argument @ 'getPlayerWantedLevel' [Expected player at argument 1, got marker]

    bad argument@ 'getPlayerOccupiedVehicle' [Expected ped at argument 1 , got vehicle]


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


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


  7. didn't work you script can't save clothes , but xXMADEXx script is working fine i can see the same clothes when i login but when other players join i got this error

    bad argument @ 'addPedClothes' [Expected String at argument 2 , got boolean]


  8. here you go you can use this simple script :

    addEventHandler( 'onClientRender', getRootElement( ), 
        function( ) 
            setTime( 22, 0 ) <----- Put time here  
        end 
    ) 
    


  9. For @ xXMADEXx your save script is working fine but i got some warnings when someone join the server :

    addEventHandler ( "onPlayerLogin", root, function ( _, account ) 
        local clothes = getAccountData ( account, "Clothes" ) 
        if not clothes then return end 
        for i, v in pairs ( fromJSON ( clothes )  do 
            local text, id = unpack ( v ) 
            addPedClothes ( source, text, id, i )  <---- here this line 
        end 
    end ) 
    

    bad argument @ 'addPedClothes' [Expected String at argument 2 , got boolean]


  10. 6000 will be good enough, that's the size of the entire map. However why would you make a local chat that cover the entire map when you have main chat?

    no it's not local chat it's main chat just i gave an example that's all.


  11. hi please i need some help here i got this warning when i hit the marker :

    function hideAllButtonsInMainWnd( ) 
        for i = 1, 17 do 
            guiSetVisible( shopGUI.buttons[i], false )  <----------- this line 
        end 
        guiSetVisible( shopGUI.buttons[ "Paintjob" ], false ) 
    end 
    

    Bad argument @ guiSetVisible [expected gui-element at argument 1, got nil]


  12. thx so if i want someone to see my message from LV and he is in SF i need to increase the chat range right .

    like this

      
    local local_chat_range = "how much i need to put here" <----example = 50000  
    local sX, sY, sZ = getElementPosition(localPlayer) 
            local rX, rY, rZ = getElementPosition(source) 
            if (getDistanceBetweenPoints3D(sX, sY, sZ, rX, rY, rZ) <= local_chat_range) then 
             chat = true 
            end 
    


  13. ok bro i will try it please i want to ask you one more question ; i create a Gui button and i want when the player click it all his clothes will gone .

    i tried many function like removePedClothes , with "onClientGUIClick" but nothing happen , thank you

    edit: nvm i fix it


  14. hi guys pleas i need some help i want to create save system for my Cj clothes shop , because when i reconnect all clothes lost this is a part of the script .

    addEvent( "onChangeClothesCJ", true ) 
    addEventHandler( "onChangeClothesCJ", root, 
    function ( CJClothesTable, CJClothesString ) 
        if ( CJClothesTable ) then 
            for int, index in pairs( CJClothesTable ) do 
                local texture, model = getClothesByTypeIndex ( int, index ) 
                if ( texture ) then 
                    addPedClothes ( source, texture, model, int ) 
                end 
            end 
         end 
    end 
    ) 
    

    i want to use setAccountData but i don't know exactly how can i put it here .