Jump to content

problem


Adham

Recommended Posts

probleam in server side

--- Client

triggerServerEvent("Save", localPlayer)

addEventHandler ( 'onClientGUIClick', root,
     function (   )
         if ( source == TheButton ) then
                  local item = guiComboBoxGetSelected ( com )    
                 local card = guiComboBoxGetItemText( com, item )
                 local name, email,number = guiGetText ( edit1 ), guiGetText ( edit2 ), guiGetTet ( edit3 )
                 if #name > 0 and #email > 0 and number > 0 and #card > 0 then
        if ( guiCheckBoxGetSelected ( GUIEditor.checkbox[1] ) ) then
                 triggerServerEvent ( "RentSystem:onCreateNewOrder", localPlayer, name, email, number, card, "classic" )
        elseif ( guiCheckBoxGetSelected ( GUIEditor.checkbox[2] ) ) then
                 triggerServerEvent ( "RentSystem:onCreateNewOrder", localPlayer, name, email, number, card, "special" )
        end
                 guiSetEnabled ( GUIEditor.button[1], false )
      end
    end
end )

                 
                 
addEvent ( "RentSystem:onSendSubscribePlayers", true )
addEventHandler ( "RentSystem:onSendSubscribePlayers", root,
      function ( Table )
         for _,v in ipairs ( Table ) do  
              local row = guiGridListAddRow ( gridlist )         
              guiGridListSetItemText ( gridlist , row,1 , v.Name , false , false )
              guiGridListSetItemText ( gridlist , row,2 , v.card , false , false )
              guiGridListSetItemText ( gridlist , row,4 , v.Serial , false , false ) 
         end
    end
)



server side
addEventHandler ("onResourceStart", resourceRoot,
   function () 
     executeSQLQuery ("CREATE TABLE IF NOT EXISTS `Save_Table` (serial,Name,card,Serial)")
end
) 
addEvent ( 'RentSystem:onCreateNewOrder', true )
addEventHandler ( 'RentSystem:onCreateNewOrder', root,
     function ( name, email, number, card )
           if ( name and email and number and card ) then
               local Name = getPlayerName ( source )
               local serial = getPlayerSerial ( source )
               local result = executeSQLQuery ( "SELECT * FROM `Save_Table` WHERE `serial` = ?", getPlayerSerial (source) ) 
               if ( result and #result == 0 ) then 
         else 
               triggerClientEvent ( source, "RentSystem:onSendSubscribePlayers",source,result ) 
       end 
     end
   end
)


addEvent("save",true) 
addEventHandler("save",root,
     function ( Name,Serial,card ) 
          executeSQLQuery("INSERT INTO Save_Table(serial,Name,Serial,card) VALUES(?,?,?,?)",getPlayerSerial(source),Name,Serial,card) 
     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...