Created
March 17, 2011 14:37
-
-
Save DfKimera/874425 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Updates the database with local variables. The design implies that only | |
* these two vars, lastposition and state, need to be updated, as everything | |
* else is done directly into the database and then refreshed into the script | |
* This will later serve for the live server preview | |
*/ | |
public AMS_UpdatePlayerPos() { | |
// Create some control/storage variables | |
new plyOrigin[3], plyOriginString[256]; // lNull[1]; | |
//new lQuery[512]; | |
new gPlayers[32], numPlayers; | |
new ply = 0; | |
// Get the player list | |
get_players(gPlayers, numPlayers, AC_GETPLAYERS_ALL); | |
// Loop thru them | |
for( new i = 0 ; i < numPlayers ; i++) { | |
ply = gPlayers[i]; // Creates a handy pointer. Avoids the known "player iteration gap" | |
// Checks if player has a character | |
if(AMSX_Player_HasSelectedChar(ply)) { | |
// Checks if user is alive | |
if(is_user_alive(ply)) { | |
// Gets player's origin and converts it to string-based coordinates | |
get_user_origin(ply,plyOrigin); | |
origin_to_coord(plyOrigin,plyOriginString); | |
} else { | |
// If he's not, we give him 0 0 0 coords. | |
zero_origin_coord(plyOriginString); | |
} | |
AMSX_UpdateCharacterInfo(AMSX_Player_GetCharacter(ply), plyOriginString, plyState[ply]); | |
} | |
} | |
return PLUGIN_CONTINUE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment