Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Player Position Detection

 
Post new topic   Reply to topic Printable version
 View previous topic  Own variables in MERVBot DLL Post :: Post invalid name  View next topic  
Author Message
tec27
Newbie


Joined: Feb 01 2003
Posts: 13
Offline

PostPosted: Sat Feb 01, 2003 9:25 pm    Post subject: Player Position Detection Reply to topic Reply with quote

I'm using mervbot and I was trying to figure out how to make it so that every time a there was a player in a square area on the map, it would start a timer. Any ideas on how to do it?
Back to top
View users profile Send private message Add User to Ignore List
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Sun Feb 02, 2003 4:31 am    Post subject: Reply to topic Reply with quote

EVENT_PlayerMove
Check player's position there (p->tile.x and p->tile.y)
_________________
3y3 4m l33t h4x0r
j0! 3y3 4m t4lking to j00!
fux0red 5cr1pt k1dd13.
-"l33t h41ku"
Back to top
View users profile Send private message Add User to Ignore List Send email
k0zy
Server Help Squatter


Gender:Gender:Male
Joined: Jan 11 2003
Posts: 571
Location: Germany
Offline

PostPosted: Sun Feb 02, 2003 4:32 am    Post subject: Reply to topic Reply with quote

a very easy way is to use the playermove event in spawn.cpp

Code: Show/Hide
case EVENT_PlayerMove:
{
Player *p = (Player*)event.p[0];

if ((p->tile.x == 512) && (p->tile.y == 512))
{
sendPublic("*timer 5");
}

}


This will start the timer when a player cosses the "center" of a map.

Damn, sos was faster... biggrin.gif

Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole....
Back to top
View users profile Send private message Add User to Ignore List
tec27
Newbie


Joined: Feb 01 2003
Posts: 13
Offline

PostPosted: Mon Feb 03, 2003 7:22 am    Post subject: Reply to topic Reply with quote

thanks, both of you, it was very helpful.
Back to top
View users profile Send private message Add User to Ignore List
ExplodyThingy
Server Help Squatter


Age:37
Gender:Gender:Male
Joined: Dec 15 2002
Posts: 528
Location: Washington DC
Offline

PostPosted: Tue Feb 04, 2003 12:21 pm    Post subject: Reply to topic Reply with quote

Can you make it so that a player can only send a command within a block of tiles? It seems to ignore it in a rectanle, but works on a specific tile. (both are within the player level command case in commands.cpp
work:
Code: Show/Hide
if ((p->tile.x == 512) && (p->tile.y == 512))
{
    if(c->check("command")
    {
           sendPrivate(p,"command recieved");
    }
}

No work:
Code: Show/Hide
if (  ((p->tile.x >> 510) && (p->tile.y >> 510))   &&   ((p->tile.x << 514) && (p->tile.y << 514))   )
{
    if(c->check("command")
    {
           sendPrivate(p,"command recieved");
    }
}


This isnt cut-and-paste, so ignore missing ";" and such junk.
_________________
There are no stupid question, but there are many inquisitive idiots.
Loot

Dr Brain> I hate clean air and clean water. I'm a member of Evil Conservitive Industries
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
k0zy
Server Help Squatter


Gender:Gender:Male
Joined: Jan 11 2003
Posts: 571
Location: Germany
Offline

PostPosted: Tue Feb 04, 2003 12:59 pm    Post subject: Reply to topic Reply with quote

Its simply "<", and not "<<"...
Try that icon_smile.gif

Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole....
Back to top
View users profile Send private message Add User to Ignore List
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Tue Feb 04, 2003 2:22 pm    Post subject: Reply to topic Reply with quote

Haha sa_tongue.gif
Back to top
View users profile Send private message Add User to Ignore List Send email
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Tue Feb 04, 2003 2:52 pm    Post subject: Reply to topic Reply with quote

This is a generic sample of code for checking if some point X, Y is inside a rectangle:

Code: Show/Hide
if (x >= X_MIN && x <= X_MAX && y >= Y_MIN && y <= Y_MAX)
Back to top
View users profile Send private message Add User to Ignore List Send email
ExplodyThingy
Server Help Squatter


Age:37
Gender:Gender:Male
Joined: Dec 15 2002
Posts: 528
Location: Washington DC
Offline

PostPosted: Tue Feb 04, 2003 2:58 pm    Post subject: Reply to topic Reply with quote

Yes, yes, thank you. I got myself tripped up on == and >= and somehow i carried it over to >>.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 645 page(s) served in previous 5 minutes.

phpBB Created this page in 0.455606 seconds : 34 queries executed (92.9%): GZIP compression disabled