Jump to content

x[تعديل]x تاج


Recommended Posts

if getElementData(source,"Tag") == true then
    cancelEvent()
end

الفرق بين كوده وكودك

ان حقك يتحقق من ان قيمة الداتا ترو

false و nil وحقه يتحقق ان الداتا لها قيمة يعني ماتكون

هو المفروض يحطها مع حدث اون بلاير شات واذا كانت ترو يطلع التاج وإذا فولس يطلع التاج الأصلي

Link to comment
كده ؟؟
  
addEventHandler('onPlayerChat',root, 
if getElementData(source,"Tag") then 
cancelEvent() 
end ) 
  
  

طبعا لا ، اذا كان الداتا حق مود التاج حقك اللي تركب منه تاجات موجود تخليه يطلعه بالشات بوكس ، إذا مب موجود الداتا يجيب التاج حق الرتبة

Link to comment

كده ؟

addEventHandler("onPlayerChat",root,function (msg,Colour) 
if getElementData(source,"tag") than 
local tag = getElementData(source,"Data_Tag") or '#FF0000[#005588Player#FF0000]'   
local colour = getElementData(source,"colour") or '#FFFFFF'   
outputChatBox(tag ..' '.. getPlayerName(source) .. ''..colour..' : '.. msg,root, r, g, b, true) 
return cancelEvent() 
end) 

Link to comment
  
addEventHandler("onPlayerChat",root,function (msg,Colour) 
if getElementData(source,"tag") == false then return cancelEvent() end -- هنا غلط than حولها then 
local tag = getElementData(source,"Data_Tag") or '#FF0000[#005588Player#FF0000]'   
local colour = getElementData(source,"colour") or '#FFFFFF'   
outputChatBox(tag ..' '.. getPlayerName(source) .. ''..colour..' : '.. msg,root, r, g, b, true) 
end) 
  

Link to comment
  
addEventHandler("onPlayerChat",root,function (msg,Colour) 
if getElementData(source,"tag") == true then return cancelEvent() end -- هنا غلط than حولها then 
local tag = getElementData(source,"Data_Tag") or '#FF0000[#005588Player#FF0000]'   
local colour = getElementData(source,"colour") or '#FFFFFF'   
outputChatBox(tag ..' '.. getPlayerName(source) .. ''..colour..' : '.. msg,root, r, g, b, true) 
end) 
  

طيب لو حبيت اسوي 2 تحقق في نفس الكودد هتبقي كده ؟

addEventHandler("onPlayerChat", root, playerChat) 
      
addEvent("onPlayeropenChat",true) 
addEventHandler("onPlayeropenChat",root,function () 
removeElementData(resourceRoot,"chat") 
end) 
  
addEvent("onPlayerCloseChat",true) 
addEventHandler("onPlayerCloseChat",root,function () 
setElementData (resourceRoot, "chat",true) 
end) 
    ------ 
    addEventHandler("onPlayerChat",root, 
    function( text, type) 
    if getElementData(source,"Data_Tag") then return end else 
    if getElementData(source,"tag") == true then return cancelEvent()  
    if type == 1 or type == 2 then return end 
    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Console")) then 
    cancelEvent() 
    local r, g, b = getPlayerNametagColor(source) 
    return outputChatBox("#FF0000* [ Console ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
    else 
    end 
    if getElementData ( resourceRoot, "chat" ) == true then cancelEvent() return outputChatBox ("[C.Console]: Chat has been locked by Console ",source,255,0,0,true) end 
    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 1")) then 
    cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#0099DC* [ Lv.1 ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 2")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#2554C7* [ Lv.2 ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 3")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#00cc11* [ Lv.3 ] " .. getPlayerName ( source ) ..": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 4")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#007700* [ Lv.4 ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 5")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#cc0000* [ Lv.5 ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 6")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#FF0000* [ Lv.6 ] " .. getPlayerName ( source ) ..": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Head.Admin")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#C11B17* [ Head.Admin ] " .. getPlayerName ( source ) ..": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
         elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("V.I.P")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#DCD800* [ VIP ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
                
                
         elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("SaedAmer")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#cd0000* [ VIP ]#ffff00 سعيد : #ffFFff" .. text, getRootElement(), r, g, b, true ) 
                
                
        elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("mosp")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#02AB2F* [ AL-MLOok Event's] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Manager")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#347235* [ T-Developer ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin - Ex")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#777777* [ Admin - EX ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Police")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#007F7F* [ Soldier ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#5494A7* [ AL-MLOoK ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
                
          
        end 
        end 
         ) 

Link to comment
  
addEventHandler("onPlayerChat", root, playerChat) 
      
addEvent("onPlayeropenChat",true) 
addEventHandler("onPlayeropenChat",root,function () 
removeElementData(resourceRoot,"chat") 
end) 
  
addEvent("onPlayerCloseChat",true) 
addEventHandler("onPlayerCloseChat",root,function () 
setElementData (resourceRoot, "chat",true) 
end) 
    ------ 
    addEventHandler("onPlayerChat",root, 
    function( text, type) 
    if getElementData(source,"Data_Tag") then return cancelEvent() end  
    if getElementData(source,"tag") == true then return cancelEvent() end 
    if type == 1 or type == 2 then return end 
    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Console")) then 
    cancelEvent() 
    local r, g, b = getPlayerNametagColor(source) 
    return outputChatBox("#FF0000* [ Console ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
    else 
    end 
    if getElementData ( resourceRoot, "chat" ) == true then cancelEvent() return outputChatBox ("[C.Console]: Chat has been locked by Console ",source,255,0,0,true) end 
    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 1")) then 
    cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#0099DC* [ Lv.1 ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 2")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#2554C7* [ Lv.2 ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 3")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#00cc11* [ Lv.3 ] " .. getPlayerName ( source ) ..": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 4")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#007700* [ Lv.4 ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 5")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#cc0000* [ Lv.5 ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Level 6")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#FF0000* [ Lv.6 ] " .. getPlayerName ( source ) ..": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Head.Admin")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#C11B17* [ Head.Admin ] " .. getPlayerName ( source ) ..": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
         elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("V.I.P")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#DCD800* [ VIP ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
                
                
         elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("SaedAmer")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#cd0000* [ VIP ]#ffff00 سعيد : #ffFFff" .. text, getRootElement(), r, g, b, true ) 
                
                
        elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("mosp")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#02AB2F* [ AL-MLOok Event's] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Manager")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#347235* [ T-Developer ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin - Ex")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#777777* [ Admin - EX ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Police")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#007F7F* [ Soldier ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
          
          
           elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then 
         cancelEvent() 
                local r, g, b = getPlayerNametagColor(source) 
                outputChatBox("#5494A7* [ AL-MLOoK ] " .. getPlayerName ( source ) .. ": #ffFFff" .. text, getRootElement(), r, g, b, true ) 
                
          
        end 
        end 
         ) 
  

Link to comment

مساعده

انا ضفت بوتن يحذف التاج

ما شتغل

كلنت

function guiGridListGetSelectedItemText ( gridList, column ) 
    local item = guiGridListGetSelectedItem ( gridList ) 
    local text = guiGridListGetItemText ( gridList, item, column or 1 ) 
    if ( text ~= '' ) then 
        return text 
    else 
        return false 
    end 
end 
  
function centerWindow(center_window) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(center_window,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(center_window,x,y,false) 
end 
  
function SetWindowVisible ( Panel , StatsP , StatsC ) 
    guiSetVisible( Panel , StatsP) 
        showCursor( StatsC ) 
            centerWindow( Panel ) 
end 
  
  
local screenW, screenH = guiGetScreenSize() 
Tag_Window = guiCreateWindow((screenW - 353) / 2, (screenH - 285) / 2, 353, 285, "Tags System", false) 
guiWindowSetSizable(Tag_Window, false) 
guiSetVisible(Tag_Window,false) 
Tag_GridList = guiCreateGridList(10, 24, 332, 207, false, Tag_Window) 
Tag_Column = guiGridListAddColumn(Tag_GridList, "Players", 0.9) 
Tag_Edit = guiCreateEdit(9, 240, 260, 24, "", false, Tag_Window) 
Tag_Buuton_G = guiCreateButton(273, 240, 69, 24, "Give Tag", false, Tag_Window) 
guiSetFont(Tag_Buuton_G, "default-bold-small") 
guiSetFont(Tag_GridList, "default-bold-small") 
 back = guiCreateButton(160, 265, 109, 9, "تراجع", false, Tag_Window) 
guiSetProperty(back, "NormalTextColour", "FFFFFFFF")         
  
addCommandHandler('TagPanel', 
function ( ) 
guiGridListClear ( Tag_GridList ) 
    for _,Value in next, getElementsByType ( "player" ) do 
        local Row = guiGridListAddRow ( Tag_GridList ) 
            guiGridListSetItemText ( Tag_GridList, Row, Tag_Column, getPlayerName ( Value ), false, false ) 
            guiGridListSetItemColor(Tag_GridList,Row,1,math.random(0,255),math.random(0,255),math.random(0,255)) 
            SetWindowVisible ( Tag_Window , not guiGetVisible(Tag_Window) , not guiGetVisible(Tag_Window) ) 
    end 
end ) 
  
addEventHandler('onClientGUIClick',Tag_Buuton_G, 
function ( ) 
    local Selected , Tag_Name = guiGridListGetSelectedItemText ( Tag_GridList, Tag_Column ) , guiGetText(Tag_Edit) 
        if ( Tag_Name ~= ' ' ) or ( Tag_Name ~= '' ) and ( guiGridListGetSelectedItem (Tag_GridList) ~= -1 ) then 
            local Plr = getPlayerFromName(Selected) 
                setElementData(Plr,'Data_Tag',Tag_Name) 
                outputChatBox("#FFFFFF[Tag System] #53CE41 ", root , 255 , 255 ,255 ,true) 
                elseif(source == back) then 
setElementData(Plr,'Data_Tag',Tag_Name, false) 
    end 
end , false ) 

سيرفر

addEventHandler('onPlayerChat',root, 
function ( msg ) 
cancelEvent ( ) 
    local Player_Name , Data = getPlayerName ( source ) , getElementData(source,'Data_Tag') 
        outputChatBox("#FF0000 * #FFFFFF[ #CD0000"..Data.."#FFFFFF ]x #A5A5A5"..Player_Name..":#CD0000 "..msg.."", root , 255 , 255 ,255 ,true) 
end ) 
  
executeSQLQuery( ' CREATE TABLE IF NOT EXISTS `Data_S` (Serial, Data) ' ) 
  
function onSave( ) 
local checkData = executeSQLQuery( ' SELECT * FROM `Data_S` WHERE Serial = ? ', getPlayerSerial(source) ) 
local Data = getElementData(source,'Data_Tag') 
    if ( type ( checkData ) == 'table' and #checkData == 0 or not checkData ) then 
        executeSQLQuery( ' INSERT INTO `Data_S` (Serial, Data) VALUES(?, ?) ', getPlayerSerial(source), Data) 
else 
local Data = getElementData(source,'Data_Tag') 
        executeSQLQuery( ' UPDATE`Data_S` SET Serial = ?, Data = ? ', getPlayerSerial(source), Data) 
    end 
end 
addEventHandler('onPlayerQuit',getRootElement(),onSave) 
addEventHandler('onPlayerLogout',getRootElement(),onSave) 
  
addEventHandler( 'onPlayerJoin', root, 
function(   ) 
local Save = executeSQLQuery( ' SELECT * FROM `Data_S` WHERE Serial = ? ', getPlayerSerial(source) ) 
    if ( type ( Save ) == 'table' and #Save == 0 or not Save ) then return end 
            setElementData(source,'Data_Tag',Save[1]['Data']) 
end ) 

Link to comment

  
function removePlayerData( player, data ) 
      local player_data = getElementData(player,data) 
      if player_data then 
            if setElementData( player, data, nil ) then 
            return true 
      end 
      return false 
end 
  
addEventHandler("onClientGUIClick", root, 
       function(    ) 
             if source == buttonName then 
                     removePlayerData(localPlayer, "Data_tag") 
             end 
       end 
) 
  
Link to comment

جرب

function guiGridListGetSelectedItemText ( gridList, column ) 
local item = guiGridListGetSelectedItem ( gridList ) 
local text = guiGridListGetItemText ( gridList, item, column or 1 ) 
if ( text ~= '' ) then 
return text 
else 
return false 
end 
end 
--------- 
function centerWindow(center_window) 
local screenW,screenH=guiGetScreenSize() 
local windowW,windowH=guiGetSize(center_window,false) 
local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
guiSetPosition(center_window,x,y,false) 
end 
--------- 
function SetWindowVisible ( Panel , StatsP , StatsC ) 
guiSetVisible( Panel , StatsP) 
showCursor( StatsC ) 
centerWindow( Panel ) 
end 
--------- 
local screenW, screenH = guiGetScreenSize() 
Tag_Window = guiCreateWindow((screenW - 353) / 2, (screenH - 285) / 2, 353, 285, "Tags System", false) 
guiWindowSetSizable(Tag_Window, false) 
guiSetVisible(Tag_Window,false) 
Tag_GridList = guiCreateGridList(10, 24, 332, 207, false, Tag_Window) 
Tag_Column = guiGridListAddColumn(Tag_GridList, "Players", 0.9) 
Tag_Edit = guiCreateEdit(9, 240, 260, 24, "", false, Tag_Window) 
Tag_Buuton_G = guiCreateButton(273, 240, 69, 24, "Give Tag", false, Tag_Window) 
guiSetFont(Tag_Buuton_G, "default-bold-small") 
guiSetFont(Tag_GridList, "default-bold-small") 
back = guiCreateButton(160, 265, 109, 9, "تراجع", false, Tag_Window) 
guiSetProperty(back, "NormalTextColour", "FFFFFFFF")         
--------- 
addCommandHandler('TagPanel', 
function ( ) 
guiGridListClear ( Tag_GridList ) 
for _,Value in next, getElementsByType ( "player" ) do 
local Row = guiGridListAddRow ( Tag_GridList ) 
guiGridListSetItemText ( Tag_GridList, Row, Tag_Column, getPlayerName ( Value ), false, false ) 
guiGridListSetItemColor(Tag_GridList,Row,1,math.random(0,255),math.random(0,255),math.random(0,255)) 
SetWindowVisible ( Tag_Window , not guiGetVisible(Tag_Window) , not guiGetVisible(Tag_Window) ) 
end 
end ) 
--------- 
addEventHandler('onClientGUIClick',Tag_Buuton_G,function ( ) 
local Selected , Tag_Name = guiGridListGetSelectedItemText ( Tag_GridList, Tag_Column ) , guiGetText(Tag_Edit) 
if ( Tag_Name ~= ' ' ) or ( Tag_Name ~= '' ) and ( guiGridListGetSelectedItem (Tag_GridList) ~= -1 ) then 
Plr = getPlayerFromName(Selected) 
setElementData(Plr,'Data_Tag',Tag_Name) 
outputChatBox("#FFFFFF[Tag System] #53CE41 ",  255 , 255 ,255 ,true) 
end 
end , false ) 
--------- 
addEventHandler('onClientGUIClick',back,function ( ) 
local Selected = guiGridListGetSelectedItemText ( Tag_GridList, Tag_Column ) 
if  guiGridListGetSelectedItem (Tag_GridList) ~= -1 then 
Plr = getPlayerFromName(Selected) 
setElementData(Plr,'Data_Tag',false) 
end 
end , false ) 

addEventHandler('onPlayerChat',root, 
function ( msg ) 
cancelEvent ( ) 
local Player_Name , Data = getPlayerName ( source ) , getElementData(source,'Data_Tag') or 'Everyone' 
outputChatBox("#FF0000 * #FFFFFF[ #CD0000"..Data .."#FFFFFF ]x #A5A5A5"..Player_Name..":#CD0000 "..msg.."", root , 255 , 255 ,255 ,true) 
end ) 
executeSQLQuery( ' CREATE TABLE IF NOT EXISTS `Data_S` (Serial, Data) ' ) 
function onSave( ) 
local checkData = executeSQLQuery( ' SELECT * FROM `Data_S` WHERE Serial = ? ', getPlayerSerial(source) ) 
local Data = getElementData(source,'Data_Tag') 
if ( type ( checkData ) == 'table' and #checkData == 0 or not checkData ) then 
executeSQLQuery( ' INSERT INTO `Data_S` (Serial, Data) VALUES(?, ?) ', getPlayerSerial(source), Data) 
else 
local Data = getElementData(source,'Data_Tag') 
executeSQLQuery( ' UPDATE`Data_S` SET Serial = ?, Data = ? ', getPlayerSerial(source), Data) 
end 
end 
addEventHandler('onPlayerQuit',getRootElement(),onSave) 
addEventHandler('onPlayerLogout',getRootElement(),onSave) 
addEventHandler( 'onPlayerJoin', root, 
function(   ) 
local Save = executeSQLQuery( ' SELECT * FROM `Data_S` WHERE Serial = ? ', getPlayerSerial(source) ) 
if ( type ( Save ) == 'table' and #Save == 0 or not Save ) then return end 
setElementData(source,'Data_Tag',Save[1]['Data']) 
end ) 
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...