• 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!

MyACC Parse error: syntax error, unexpected '->' when trying to make kill counter

SixNine

Active Member
Joined
Dec 12, 2018
Messages
452
Reaction score
41
PHP:
<td valign="top" width="55" height="18" background="images/character/n1.png"></td><td width="45" height="18" background="images/character/s0b.png"><center><b>'.player->getStorage(69420).'</b></center></td>

this is playerdeath.lua
Lua:
    --my aac counter without limit
    if killer:isPlayer() then
        if killer:getStorageValue(69420) < 0 then
            killer:setStorageValue(69420, 1)
        else
            killer:setStorageValue(69420, killer:getStorageValue(69420)+1)
        end
    end

it suppose to show kills for example of you kill 60 players it would say

Kills: 60

but im getting this error in my characters.php

Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ',' or ';' in /var/www/html/system/pages/characters.php on line 630
 
Solution
You can also add (int) before $player->getStorage(69420) to make it show 0 for players who have no storage value:
PHP:
<td valign="top" width="55" height="18" background="images/character/n1.png"></td><td width="45" height="18" background="images/character/s0b.png"><center><b>'.(int)$player->getStorage(69420).'</b></center></td>
You can also add (int) before $player->getStorage(69420) to make it show 0 for players who have no storage value:
PHP:
<td valign="top" width="55" height="18" background="images/character/n1.png"></td><td width="45" height="18" background="images/character/s0b.png"><center><b>'.(int)$player->getStorage(69420).'</b></center></td>
 
Solution
php is money, so you use dollars for variables; $player
You can also add (int) before $player->getStorage(69420) to make it show 0 for players who have no storage value:
PHP:
<td valign="top" width="55" height="18" background="images/character/n1.png"></td><td width="45" height="18" background="images/character/s0b.png"><center><b>'.(int)$player->getStorage(69420).'</b></center></td>
Always shows 0, even tho there is storages set
5a509d57bd48cdc5f5acd3dab540b79c.png

Post automatically merged:

</td><td width="45" height="18

php is money, so you use dollars for variables; $player
You can also add (int) before $player->getStorage(69420) to make it show 0 for players who have no storage value:
PHP:
<td valign="top" width="55" height="18" background="images/character/n1.png"></td><td width="45" height="18" background="images/character/s0b.png"><center><b>'.(int)$player->getStorage(69420).'</b></center></td>
Hmm even when you kill the player it always shows Kills: 0
 
Back
Top