how to make a unequip button
how to make a unequip button
hey i got my equipment and equipped.php files and they work, but what if i wanted to unequip a weapon, how do i make a code for that
Re: how to make a unequip button
There is really no need for an unequip you just equip something else but you could make a piece of equipment called nothing and then just have that be equipped with the attributes at 0 or whatever.
Re: how to make a unequip button
Well, if you followed the tutorials, you know there`s a query to UPDATE the items table. To unequip, you can UPDATE the table and SET weapons/armor/headgear whatever to blank.
So: "UPDATE tablename SET weapon = '' WHERE user_Id = $someId"
However, for better usage, i reccomend you use a keyword to let the program know the character has nothing equipped. Otherwise you get failed queries for selecting weapons, which will return a false negative. Like SET weapon = 'empty', that way, you won`t get the false negative, instead you know it`s empty. Seems better if you ask me.
So: "UPDATE tablename SET weapon = '' WHERE user_Id = $someId"
However, for better usage, i reccomend you use a keyword to let the program know the character has nothing equipped. Otherwise you get failed queries for selecting weapons, which will return a false negative. Like SET weapon = 'empty', that way, you won`t get the false negative, instead you know it`s empty. Seems better if you ask me.