how to make a unequip button

Post all your tuts or request for tuts here.
Post Reply
dust1031
Posts: 92
Joined: Fri Jul 22, 2011 3:38 am

how to make a unequip button

Post by dust1031 »

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
User avatar
Nexus
Posts: 293
Joined: Sat Jun 18, 2011 10:42 pm

Re: how to make a unequip button

Post by Nexus »

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.
Xaleph
Posts: 897
Joined: Mon Feb 07, 2011 2:55 am

Re: how to make a unequip button

Post by Xaleph »

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.
Post Reply

Return to “Tutorials”