SkatCh

Members
  • Content Count

    366
  • Joined

  • Last visited

Posts posted by SkatCh


  1. sorry i don't undrestand can you explane to me.

    this is my script ;

    - server side

    addEventHandler("onResourceStart", getRootElement(), 
    function(theMap) 
        local playerList = getPlayersName() 
        if playerList then 
            callRemote("My website", returnFunction, playerList) 
        end 
    end) 
      
    function returnFunction(value) 
        if value ~= "ERROR" then 
           outputDebugString("done") 
        end 
    end 
      
    function getPlayersName() 
        local playerslist = {} 
        for i,p in ipairs (getElementsByType("player")) do 
            local thep = string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "") 
            table.insert(playerslist,tostring(thep)) 
        end 
        return playerslist 
    end 
    

    and what i need to add inside the PHP


  2. hi guys :) please i need some help , i have a simple question how can add players names inside my website using php sdk i know how to use callRemote , i add this and it's working fine i can see 'done' in my debugString but what i need to do to finish the php file.

    addEventHandler("onResourceStart", getRootElement(), 
    function(theMap) 
        local playerList = getPlayersName() 
        if playerList then 
            callRemote("My website", returnFunction, playerList) 
        end 
    end) 
      
    function returnFunction(value) 
        if value ~= "ERROR" then 
           outputDebugString("done") 
        end 
    end 
      
    function getPlayersName() 
        local playerslist = {} 
        for i,p in ipairs (getElementsByType("player")) do 
            local thep = string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "") 
            table.insert(playerslist,tostring(thep)) 
        end 
        return playerslist 
    end 
    


  3. Hi guys , please i have a question can anyone tell me jetpack it's a weapon or an object .

    How can i change it to an other one (mod) . i have a dff and txd file but i don't know what i need to do to replace it .


  4. Use triggerClientEvent:

    -- client side

    addEvent("Sound",true) 
    addEventHandler("Sound", getRootElement(), 
    function() 
     local  Sound = playSound(".........mp3")  -- put your sound file here 
     setSoundVolume(Sound, 1) 
    end) 
    

    -- server side

    triggerClientEvent(........, "Sound",......) 
    


  5. Here you go e.g:

    local x = -- x coordination 
    local y = -- y coordination 
    local z = -- z coordination 
      
    addEventHandler("onClientRender",getRootElement(), 
    function() 
        local px,py,pz = getElementPosition(getLocalPlayer()) 
        local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) 
        if distance <= 150 then 
            local sx,sy = getScreenFromWorldPosition ( x, y, z+0.95, 0.06 ) 
            if not sx then return end 
            local scale = 1/(0.3 * (distance / 150)) 
            dxDrawText ( "XeroxMTA", sx, sy - 30, sx, sy - 30, tocolor(255,255,255,255), math.min ( 0.4*(150/distance)*1.4,4), "bankgothic", "center", "bottom", false, false, false ) 
        end 
    end 
    ) 
    


  6. Try this :

    local sql = dbQuery(handler,"SELECT * FROM bag") 
         local resultTable = dbPoll(sql, -1) 
              if resultTable then 
                   for rowNum, rowData in pairs(resultTable) do 
                        local bID = rowData['ID'] 
                        local newID = bID + 1 
                        dbExec(handler,"INSERT INTO bag (TYPE) VALUES ('1')") 
                        outputChatBox("ADD BAGBACK ID "..tonumber(newID).."",source,125,0,0,true) 
    


  7. function checkShipment(button, state, thePlayer) 
    local level = getElementData(thePlayer, "level") 
       if (source==bCheck) then 
        if (button ~= "left" or state ~= "down") then return end 
      
    -- < your code here >  
      
    end  
    end 
    


  8. Next time try to fix it by yourself . Never give up

    Anyway :

    -- Client side:

    local getPlayerRow = {} 
      
    isVisible = false 
      
    function createGui() 
        local screenWidth, screenHeight = guiGetScreenSize() 
        local windowWidth, windowHeight = 283, 410 
        local windowX, windowY = (screenWidth / 2) - (windowWidth / 2), (screenHeight / 2) - (windowHeight / 2) 
        mainWnd = guiCreateWindow(windowX, windowY, windowWidth, windowHeight,  "Player Manager", false) 
        tabPanel = guiCreateTabPanel(0, 0.1, 1, 1, true, mainWnd) 
        guiSetVisible(mainWnd, true) 
        showCursor(true) 
        tabAcc = guiCreateTab("Accounts", tabPanel) 
            accountGrid = guiCreateGridList(9, 23, 249, 228, false, tabAcc) 
            guiGridListSetSelectionMode(accountGrid, 0) 
            refreshButton = guiCreateButton(9, 258, 80, 26, "Refresh", false, tabAcc) 
            deleteButton = guiCreateButton(110, 258, 80, 26, "Delete", false, tabAcc) 
            closeButton = guiCreateButton(228, 258, 26, 26, "X", false, tabAcc) 
            guiGridListAddColumn(accountGrid, "Account Name", 0.91) 
            triggerServerEvent("serverGetAccounts", localPlayer, localPlayer) 
             
             
            tabSerial = guiCreateTab("Serials", tabPanel) 
            playerGrid = guiCreateGridList(9, 23, 249, 228, false, tabSerial) 
            guiGridListAddColumn(playerGrid, "Name", 0.91) 
            guiGridListSetSelectionMode(playerGrid, 0) 
            refreshButton = guiCreateButton(9, 258, 80, 26, "Refresh", false, tabSerial) 
            fetchButton = guiCreateButton(110, 258, 80, 26, "Fetch", false, tabSerial) 
            closeButton = guiCreateButton(228, 258, 26, 26, "X", false, tabSerial) 
            editUser = guiCreateEdit(5, 300, 255, 30, "", false, tabSerial) 
            triggerServerEvent("serverGetPlayers", localPlayer, localPlayer) 
    end 
      
    function handleCommand() 
            if (isVisible == false) then 
                isVisible = true 
                createGui() 
            elseif (isVisible == true) then 
                guiSetVisible(mainWnd, false) 
                showCursor(false) 
                isVisible = false 
            end 
    end 
    addCommandHandler("plr", handleCommand) 
      
      
    --------------------------------- 
    --          Account manager 
    --------------------------------- 
    function refreshGridlist(accountTable) 
        guiGridListClear(accountGrid) 
        for index, account in ipairs(accountTable) do 
            local row = guiGridListAddRow(accountGrid) 
            guiGridListSetItemText(accountGrid, row, 1, tostring(account), false, false) 
        end 
    end 
    addEvent("serverGivesAccounts", true) 
    addEventHandler("serverGivesAccounts", getRootElement(), refreshGridlist) 
      
    function buttonHandler() 
        if (source == refreshButton) then 
            triggerServerEvent("serverGetAccounts", localPlayer, localPlayer) 
        elseif (source == deleteButton) then 
            local row,col = guiGridListGetSelectedItem(accountGrid) 
            if row and col and row ~= -1 and col ~= -1 then 
                local targetAccount = guiGridListGetItemText(accountGrid, row, 1) 
                triggerServerEvent("requestAccountDelete", localPlayer, targetAccount) 
                triggerServerEvent("serverGetAccounts", localPlayer, localPlayer) 
            end 
        end 
        if (source == closeButton) then 
            guiSetVisible(mainWnd, false) 
            showCursor(false) 
        end 
    end 
    addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), buttonHandler) 
      
      
    --------------------------------- 
    --          Serial Manager 
    --------------------------------- 
      
    -- Add players to grid list: 
    function addPlayersToGridlist() 
       guiGridListClear(playerGrid) 
        for index, players in pairs(getElementsByType("player")) do  
            local row = guiGridListAddRow(playerGrid) 
            local name = getPlayerName(players) 
            guiGridListSetItemText(playerGrid, row, 1, name, false, false) 
            getPlayerRow[players] = row 
        end 
     end 
    addEvent("serverGivesPlayers",true) 
    addEventHandler("serverGivesPlayers",root,addPlayersToGridlist) 
      
    function buttonHandler2() 
    -- Fetch button 
        if (source == fetchButton) then 
            local row,col = guiGridListGetSelectedItem(playerGrid) 
            if row and col and row ~= -1 and col ~= -1 then 
                local targetPlayer = guiGridListGetItemText(playerGrid, row, 1) 
                local serial = getPlayerSerial (targetPlayer ) 
                guiSetText(editUser,serial) 
            end 
        end 
    -- Refresh button 
    if (source == refreshButton) then 
        guiGridListClear(playerGrid) 
        for k,v in ipairs (getElementsByType("player")) do 
            local name = string.lower(getPlayerName(v)) 
            if (name) then 
                local row = guiGridListAddRow(playerGrid) 
                guiGridListSetItemText(playerGrid,row,1,getPlayerName(v),false,false) 
                getPlayerRow[v] = row 
            end 
        end 
    end  
    -- Close button 
        if (source == closeButton) then 
            guiSetVisible(mainWnd, false) 
            showCursor(false) 
        end 
    end 
    addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), buttonHandler2) 
    

    -- server side:

    --------------------------------- 
    --          Account manager 
    --------------------------------- 
    function getTheAccounts(client) 
        accountTable = getAccounts() 
        local tempTable = {} 
        if(#accountTable == 0)then 
            outputDebugString("No accounts in database!") 
        else 
        for index, account in pairs(accountTable) do 
            table.insert(tempTable, getAccountName(account)) 
        end 
        triggerClientEvent(client, "serverGivesAccounts", client, tempTable) 
        end 
    end 
    addEvent("serverGetAccounts", true) 
    addEventHandler("serverGetAccounts", getRootElement(), getTheAccounts) 
      
    function deleteAccount(targetAccount) 
        if getAccount(targetAccount) then 
            removeAccount(getAccount(targetAccount)) 
            outputChatBox("The account "..targetAccount.." has been deleted.") 
        end 
    end 
    addEvent("requestAccountDelete", true) 
    addEventHandler("requestAccountDelete", getRootElement(), deleteAccount) 
      
    function getThePlayers(client) 
    triggerClientEvent(client, "serverGivesPlayers", client) 
    end 
    addEvent("serverGetPlayers", true) 
    addEventHandler("serverGetPlayers", getRootElement(), getThePlayers) 
      
    


  9. First calm down,

    Second It is not that serious like you are thinking, Its just a freaking script.

    Third your "ffffaasssst!!!!111" will not make it any better for us to help you, after all it is in our hands to help you or not.

    Fourth and last, try your self to fix it using the following function:-

    setElementVisibleTo 
    

    i agree with you , anyway he already gave u the correct answer.


  10. It's easy just just you need to use "triggerClientEvent" .

    e.g:

    -- Client side:

    addEvent("Sound",true) 
    addEventHandler("Sound", getRootElement(),  
    function() 
     local  Sound = playSound(".........mp3")  -- put your sound file here  
     setSoundVolume(Sound, 1) 
    end) 
    

    -Server side:

    triggerClientEvent(........, "Sound",......)