Jump to content

[HELP] Delete Character From PHPMYADMIN


adeh001ok

Recommended Posts


I see people here have extraordinary potential. But I have a serious problem so I ask you to help me

Spoiler

mta-screen_2019-04-21_17-35-36.png


Server

function DeleteChara()
	if (getElementData(theElement,"account:charselect:id")) then
		local dbid = getElementData(theElement,"account:charselect:id")
		local escapedID = exports.mysql:escape_string(dbid)
		local result = exports.mysql:query("SELECT * FROM characters WHERE id='" .. dbid .. "'")
		local fetch = exports.mysql:fetch_assoc(result)
		local query = exports.mysql:query("DELETE * FROM characters WHERE id='" .. dbid .. "'")
		if query then
			outputChatBox("Successfully deleted this character!", source, 0, 255, 0)
			refreshCharacters()
		else
			outputChatBox("ERROR!", source, 255, 0, 0)
		end
	end
end
addEvent("accounts:DeleteChara", true)
addEventHandler("accounts:DeleteChara", getRootElement(), DeleteChara)


Client

function closeDelChar()
	destroyElement(myWindow)
	showCursor(true)
end

function DeleteChara()
    triggerServerEvent("accounts:DeleteChara", localPlayer)
end

function delChar()
    myWindow = guiCreateWindow ( 0.3, 0.3, 0.3, 0.2, "Information", true )
    
    -- Button Boss
    bClose = guiCreateButton(0.550, 0.5, 0.4, 0.2, "No", true, myWindow)
        addEventHandler("onClientGUIClick", bClose, closeDelChar)
        
    bAccept = guiCreateButton(0.050, 0.5, 0.4, 0.2, "Yes", true, myWindow)
        addEventHandler("onClientGUIClick", bAccept, DeleteChara)
        
    -- Text
    lText = guiCreateLabel(0.025, 0.2, 1.0, 0.3, "Are You Sure?\nTo Delete This Character.", true, myWindow)
        guiSetFont(lText, "default-bold-small")
        guiLabelSetHorizontalAlign(lText, "center", true)
end
addEvent( "delChar", true)
addEventHandler( "delChar", localPlayer, delChar)

 

Link to comment
4 hours ago, adeh001ok said:


I see people here have extraordinary potential. But I have a serious problem so I ask you to help me

  Hide contents

mta-screen_2019-04-21_17-35-36.png


Server


function DeleteChara()
	if (getElementData(theElement,"account:charselect:id")) then
		local dbid = getElementData(theElement,"account:charselect:id")
		local escapedID = exports.mysql:escape_string(dbid)
		local result = exports.mysql:query("SELECT * FROM characters WHERE id='" .. dbid .. "'")
		local fetch = exports.mysql:fetch_assoc(result)
		local query = exports.mysql:query("DELETE * FROM characters WHERE id='" .. dbid .. "'")
		if query then
			outputChatBox("Successfully deleted this character!", source, 0, 255, 0)
			refreshCharacters()
		else
			outputChatBox("ERROR!", source, 255, 0, 0)
		end
	end
end
addEvent("accounts:DeleteChara", true)
addEventHandler("accounts:DeleteChara", getRootElement(), DeleteChara)


Client


function closeDelChar()
	destroyElement(myWindow)
	showCursor(true)
end

function DeleteChara()
    triggerServerEvent("accounts:DeleteChara", localPlayer)
end

function delChar()
    myWindow = guiCreateWindow ( 0.3, 0.3, 0.3, 0.2, "Information", true )
    
    -- Button Boss
    bClose = guiCreateButton(0.550, 0.5, 0.4, 0.2, "No", true, myWindow)
        addEventHandler("onClientGUIClick", bClose, closeDelChar)
        
    bAccept = guiCreateButton(0.050, 0.5, 0.4, 0.2, "Yes", true, myWindow)
        addEventHandler("onClientGUIClick", bAccept, DeleteChara)
        
    -- Text
    lText = guiCreateLabel(0.025, 0.2, 1.0, 0.3, "Are You Sure?To Delete This Character.", true, myWindow)
        guiSetFont(lText, "default-bold-small")
        guiLabelSetHorizontalAlign(lText, "center", true)
end
addEvent( "delChar", true)
addEventHandler( "delChar", localPlayer, delChar)

 

Since you're using leaked/stolen scripts, I don't think anyone will help you. And as you can see, the debug string is saying that you're trying to compare a number with a nil value.

Edited by ℓιgнт
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...