View Single Post
  #4  
Old 07-27-2012, 07:48 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
An easier more efficient approach would be to create a multi-dimensional array of warp coordinates:

PHP Code:
function onCreated(){
  
//x, y
  
this.warplocations = {
    {
510},
    {
520},
    {
530},
    {
540},
    {
1510},
    {
1520},
    {
1530},
    {
1540},
  };
  
this.warpamount this.warplocations.size();

And then increment an array index variable each time a player enters:

PHP Code:
function onPlayerEnters(){
  
player.this.warplocations[this.warpindex][0];
  
player.this.warplocations[this.warpindex][1];
  
//Use % to reset a value back to 0 if it overlaps specified value
  
this.warpindex = (this.warpindex 1) % this.warpamount;

Reply With Quote