Raised This Month: $ Target: $400
 0% 

Get all player origins and display nearest marker


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mazmaajinsh
Senior Member
Join Date: Apr 2005
Location: Latvia
Old 02-18-2009 , 16:01   Get all player origins and display nearest marker
Reply With Quote #1

Hello.
Could someone help me editing this script, so it doesnt get only the origin of the player who used the command cup_nearestmarker, but it shows the nearest markers of the all alive players. Here are the code i think you will need to help me
Code:
public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     register_concmd("cup_nearestmarker", FUNC_CMD_NEARESTMARKER, ADMIN_CUP_MARKERS, helpNearestCupMarker); } new const msgPrefix[] = "[KZ CUP]"; //new const msgNoMarkers[] = "% sUnable to start a cup. There are not enough cup markers."; new const msgNoMarkersA[] = "%s There are no cup markers."; new const msgSetMarker[] = "%s Set cup marker %d at position: %f, %f, %f"; new const msgRemovedMarker[] = "%s Removed cup marker #%d from position: %f, %f, %f"; new const msgNearestMarker[] = "Nearest marker: %d"; ////////////////////////////////////////////////// // cmd_markers_nearest( id ) ////////////////////////////////////////////////// /** (admin cmd) Display the nearest marker. Access Level: ADMIN_CUP_MARKERS */ public cmd_markers_nearest( id ) {     if (access(id, ADMIN_CUP_RACE))     {         new markernum = get_nearest_marker(id);         if (markernum > 0)   // print nearest marker (if set)         {             client_print(id, print_chat, msgNearestMarker, msgPrefix, markernum);                         } else {             client_print(id, print_chat, msgNoMarkersA, msgPrefix);         }     }         return PLUGIN_HANDLED; } ////////////////////////////////////////////////// // get_player_origin ////////////////////////////////////////////////// /** Get a client's origin; value is returned in origin[] parameter. */ get_player_origin( id, Float:origin[3] ) { // get player's origin as a Float; move position down to floor entity_get_vector( id, EV_VEC_origin, origin ); origin[2] -= 30; // raise the origin position up if player is ducking if (entity_get_int(id, EV_INT_flags) & FL_DUCKING) {     origin[2] += 18; } } ////////////////////////////////////////////////// // get_nearest_marker( id ) ////////////////////////////////////////////////// /** Return the marker nearest to the client. */ get_nearest_marker( id ) { new num = 0; if (gMarkerCount > 0) { // get players origin new Float:vOrigin[3]; entity_get_vector(id, EV_VEC_origin, vOrigin); // create and set dist variable to distance to 1st marker pos new Float:dist = 0.0; new Float:nearest = vector_distance(vOrigin, gfMarkerPos[0]); num = 1; // loop through all marker positions looking for nearest marker for (new i = 1; i < gMarkerCount; i++) {     dist = vector_distance(vOrigin, gfMarkerPos[i]);     if (dist < nearest)     {         nearest = dist;         num = i + 1;     } } } return num; }

So when player uses command cup_nearestmarker it shows Player1 [marker number] player2 [markernumber] player3 [markernumber] etc.
__________________
Ahujena
mazmaajinsh is offline
mazmaajinsh
Senior Member
Join Date: Apr 2005
Location: Latvia
Old 03-02-2009 , 10:27   Re: Get all player origins and display nearest marker
Reply With Quote #2

bump
__________________
Ahujena
mazmaajinsh is offline
mazmaajinsh
Senior Member
Join Date: Apr 2005
Location: Latvia
Old 03-06-2009 , 10:24   Re: Get all player origins and display nearest marker
Reply With Quote #3

could anyone help?
__________________
Ahujena
mazmaajinsh is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode