• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Windows [PHP] Add item to Player

atyll

Member
Joined
Dec 30, 2008
Messages
380
Reaction score
16
Hello

I have a script that adds item to player.
The problem is, sometimes it works and sometimes it doesnt. Could somebody check my code and tell me what's wrong? I think there must be something with the query. It should add item to player's DEPOT.
My code already checks if the player is logged in or not, if logged in, the script doesnt execute, which means the problem can't be that the player is logged in.

All help appreciated

Example code:
PHP:
// add Noble Armor

$check_sid = mysql_query("SELECT sid FROM player_depotitems WHERE player_id='$player_id'")
or die(mysql_error());
$get_sid = mysql_fetch_array( $check_sid );

// add reward
$calc = $get_sid['sid'];
$sid = calc + 1;

mysql_query(" INSERT INTO `database`.`player_depotitems` (
`player_id` ,
`depot_id` ,
`sid` ,
`pid` ,
`itemtype` ,
`count`
)
VALUES (
'$player_id', '0', '$sid', '101', '2486', '1'
)");


I have tested the code myself and it always added me item, but for some players it doesnt. I need to modify the code, so it will precisely and reliably always add item to player
 
Last edited:
Back
Top