Archive > 0.4.x Custom/Unofficial Modules

AutoMsg.php

<< < (2/4) > >>

Nytridr:
maybe be able to send it to just ranks also..

!automsg SC msg..   This would send to SC, Gens, and Prez's
!automsg gens msg..   Gens and prez
!automsg rank msg..   Look up/\
!automsg all msg..   this would send to all reguardless of the rank.

also I am getting this error

--- Code: ---Fatal error: Cannot use string offset as an array in C:\aobots\Bebot\custom\modu
les\automsg.php on line 96
--- End code ---

Temar:
line 95 and 96

--- Code: --- $highestmsg = $this -> bot -> db -> select("SELECT ID FROM #___automsgs ORDER BY ID DESC LIMIT 1", MYSQL_ASSOC);
$this -> highestmsg = $highestmsg[0][ID];

--- End code ---
This is basicly getting list ording by ID desc
then getting the ID of the 1st entry so basicly geting highest
im not sure why you got that error

Temar:
ah i think it maybe due to an empty table

try this

--- Code: --- $highestmsg = $this -> bot -> db -> select("SELECT ID FROM #___automsgs ORDER BY ID DESC LIMIT 1", MYSQL_ASSOC);
if (!empty($highestmsg))
$this -> highestmsg = $highestmsg[0][ID];
else
$this -> highestmsg = 0;

--- End code ---

Nytridr:
That works, new problem..


--- Code: ---rsbot [2007-09-02 05:45:35]     [TELL]  [INC]   Nytridra: !automsg add this is o
nly a test
MySQL error (# 0) on query: INSERT INTO rsbot_automsgs (type, added_by, added_at
, msg) VALUES ('text', 'Nytridra', 1188711935, 'this is only a test')
Unknown column 'type' in 'field list'
rsbot [2007-09-02 05:45:35]     [TELL]  [OUT]   -> Nytridra: Message Added as ID
 0 and Sent to Those Online.
--- End code ---

and ofc this one..


--- Code: ---rsbot [2007-09-02 06:00:42]     [TELL]  [INC]   Nytridra: !automsg addb Test
MySQL error (# 0) on query: INSERT INTO rsbot_automsgs (type, added_by, added_at
, msg) VALUES ('blob', 'Nytridra', 1188712842, 'Test')
Unknown column 'type' in 'field list'
rsbot [2007-09-02 06:00:42]     [TELL]  [OUT]   -> Nytridra: Message Added as ID
 0 and Sent to Those Online.
--- End code ---

Temar:
yer im alerady aware of that prob
bug with make table field "type" isnt there
but is in the update table part im not sure why it doesnt work

Change it to this near top of file


--- Code: ---$db -> query("CREATE TABLE IF NOT EXISTS ".$db -> define_tablename("automsgs", "true")." (
           ID INT NOT NULL auto_increment PRIMARY KEY,
   type VARCHAR(20) DEFAULT 'text' NOT NULL,
   added_by VARCHAR(30) default NULL,
   added_at INT NOT NULL default '0',
           msg TEXT
           )");

--- End code ---

you can drop current table then let it make or add the field ur self

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version