Live map
#1

So, i was thinking of creating a live map.
I might be able to do it but i have a few questions.

1. If you save the player's coordinates every x seconds and export that to the database and finally to the livemap that updates every x seconds, would that cause server lag and what is the best way to do it?
2. Would you like to see this released once its done?
Reply
#2

I don't think it would lag the server, the way I'm thinking of it, you'll be extracting every player on a 2D map, so you only need x pos and y pos for every online player, basically onlineplayers * 2 float values. If you are able to save those data into the database, (make a table like "map_positions" or so). Take the max player limit number, that's your rows, and use three columns one for the player id, one for x and one y. Afterwards, through php I guess access that table, get the coords and simulate them on a map on a browser. Could work.

You can enhance later on to show names too and stuff.
Reply
#3

I update my player positions through a mysql query, every 1 second. One big string, not separate rows...

http://www.copsandrobbersrpg.com/map/
Reply
#4

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
I update my player positions through a mysql query, every 1 second. One big string, not separate rows...

http://www.copsandrobbersrpg.com/map/
Could you send me a simple loop on how i can check the coordinates, i can do the MySQL myself.
Reply
#5

Quote:
Originally Posted by Jimmy0wns
Посмотреть сообщение
Could you send me a simple loop on how i can check the coordinates, i can do the MySQL myself.
I just put their name then their X,Y,Z and some other information like team.

If the player is offlline I put "NULL", so for 3 slot server, if slot 1 was the only person on, slot 0 and 2 are offline, hence NULL.

NULL|KyleSmith,568.0,231.65,0.0|NULL
Reply
#6

pawn Код:
SaveCoords(playerid)
{
    new Query[500];
    //87 format(Query, 500, "UPDATE `coords` SET `PositionX` = '%d', `PositionY` = '%d', `PositionZ` = '%d', `Angle` = '%d' LIMIT 1",
    cInfo[playerid][posX],
    cInfo[playerid][posY],
    cInfo[playerid][posZ],
    cInfo[playerid][angle],
    //92 mysql_query(Query);
}
What am i doing wrong here? As it gives me this error:
Код:
(87 -- 92) : error 001: expected token: ",", but found ";"
I used // to show where the lines are.
Reply
#7

Cause you use // for the format and the cInfo lines are for the format.

If you comment out format you need to comment out cInfo too.
Reply
#8

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
Cause you use // for the format and the cInfo lines are for the format.

If you comment out format you need to comment out cInfo too.
Read the post again, i used // to show where the lines are.
Reply
#9

cInfo[playerid][angle], needs to be cInfo[playerid][angle]);
Reply
#10

cInfo[playerid][angle],
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)