- Joined
- Jun 3, 2010
- Messages
- 30
- Reaction score
- 2
Good evening,
I have a piece of code where users activate a certain buff, but the check if users actually have the item for this is missing
This is the code:
Now what happens;
A user uses the buff called "Forced" and it will be activated for 6 hours.
But right now it is possible that after the buff expires, or even don't currently have the buff, they can use the link to the item in the browser to activate it anyway.
How do I add a check to the function that will check if the user has the item?
Thanks in advance!
Nathan
I have a piece of code where users activate a certain buff, but the check if users actually have the item for this is missing
This is the code:
PHP:
if( $kind=='Unnatural' OR $kind=='Inner' OR $kind=='Artificial' OR $kind=='Final' OR $kind=='Pandemonium' OR $kind=='Forced' OR $kind=='Liquid' OR $kind=='Elements' ) {
DoQuery("INSERT INTO `active_bufs` SET `CharID`='".mysql_real_escape_string($character_obj->id)."', `BufKind`='Potion', `BufName`='".mysql_real_escape_string($kind)."', `Date`=now(), `Duration`='6' ON DUPLICATE KEY UPDATE `BufName`='".mysql_real_escape_string($kind)."', `Date`=now()");
$used = 1;
}
if ($used == 1){
$error = '<div class="error_green">'._("Resource succesfully used").'</div>';
}else{
if ( !isset($error) ){ $error = '<div class="error_red">'._("Sorry..you don't have this item in your inventory, or can't use it").'</div>'; }
$character_obj->AddResource(1,$kind,1);
Now what happens;
A user uses the buff called "Forced" and it will be activated for 6 hours.
But right now it is possible that after the buff expires, or even don't currently have the buff, they can use the link to the item in the browser to activate it anyway.
How do I add a check to the function that will check if the user has the item?
Thanks in advance!
Nathan

