View Single Post
  #7  
Old 08-27-2006, 06:08 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Thanks that works but I cant use it how I want to.

I'm trying to script a map.

Instead of having each client checking the locations of each other player while they're viewing the map I intend to have a database NPC store the locations and get them every 0.5 seconds if there is someone viewing the map. Then, each player can get the data from the database NPC rather than getting the information themselves.

However, I have a problem. I cant seem to pass associative arrays as params from one npc to another.

Heres what I have so far:

MapDB NPC
PHP Code:
public function pollInfo() {
playernames.clear();
oldplayers.clear();
for (
plplayers) {
  
olplayers.(@ pl.account) = {pl.level,pl.x,pl.y};
  
playernames.add(pl.account);
 }
}

public function 
getPlayerNames() {
  return 
playernames;
}

public function 
getLocations() {
  return 
olplayers;


part of Map NPC
PHP Code:
function onActionServerside() {
//retrieve data from the mapdb npc
mapdb findnpc("MapDB");
mapdb.pollInfo();
playernames mapdb.getPlayerNames();
locations mapdb.getLocations();
//send data back to the client
player.chat  locations//Does not contain any account names, but it should.
triggeraction(0,0,"clientside","Map",playernames,locations);

}
//#CLIENTSIDE 
Playernames gets returned correctly but locations is not. It loses the subvariables that have been set.
Reply With Quote