Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-----------------------------------------------------------------------------------|
- // [svCoordinates] |
- // |
- // |
- // - You may not remove these credits |
- // - You may not claim this script as yours |
- // |
- // |
- // |
- // [VERSION 1.0] Created by SuperViper |
- //-----------------------------------------------------------------------------------|
- #include <a_samp>
- // ==================================== SETTINGS ================================== //|
- // //|
- /* Comment this line if you want all players to be able to use this command */ //|
- #define ONLY_RCON_ADMINS //|
- // //|
- // ================================================================================ //|
- // DO NOT TOUCH ANYTHING BELOW THIS //|
- // ================================================================================ //|
- forward svCoordinates_UpdateCoordinates();
- new bool: svCoordinates_PlayerToggle[MAX_PLAYERS];
- new PlayerText: PlayerCoordinates;
- public svCoordinates_UpdateCoordinates()
- {
- #if defined USE_FOREACH
- foreach(new playerid: Player)
- {
- #if defined ONLY_RCON_ADMINS
- if(IsPlayerAdmin(playerid))
- {
- if(svCoordinates_PlayerToggle[playerid] == true)
- {
- new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
- GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
- format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
- PlayerTextDrawSetString(playerid, PlayerCoordinates, string);
- }
- }
- #else
- if(svCoordinates_PlayerToggle[playerid] == true)
- {
- new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
- GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
- format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
- PlayerTextDrawSetString(playerid, PlayerCoordinates, string);
- }
- #endif
- }
- #else
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
- {
- #if defined ONLY_RCON_ADMINS
- if(IsPlayerAdmin(playerid))
- {
- if(svCoordinates_PlayerToggle[playerid] == true)
- {
- new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
- GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
- format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
- PlayerTextDrawSetString(playerid, PlayerCoordinates, string);
- }
- }
- #else
- if(IsPlayerConnected(playerid))
- {
- if(svCoordinates_PlayerToggle[playerid] == true)
- {
- new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
- GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
- format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
- PlayerTextDrawSetString(playerid, PlayerCoordinates, string);
- }
- }
- #endif
- }
- #endif
- return 1;
- }
- public OnFilterScriptInit()
- {
- SetTimer("svCoordinates_UpdateCoordinates", 1500, 1);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/coordinates", true) || !strcmp(cmdtext, "/coords", true))
- {
- #if defined ONLY_RCON_ADMINS
- if(IsPlayerAdmin(playerid))
- {
- if(svCoordinates_PlayerToggle[playerid] == false)
- {
- new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
- svCoordinates_PlayerToggle[playerid] = true;
- GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
- format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
- PlayerCoordinates = CreatePlayerTextDraw(playerid, 320.000000, 428.000000, string);
- PlayerTextDrawAlignment(playerid, PlayerCoordinates, 2);
- PlayerTextDrawBackgroundColor(playerid, PlayerCoordinates, 255);
- PlayerTextDrawFont(playerid, PlayerCoordinates, 2);
- PlayerTextDrawLetterSize(playerid, PlayerCoordinates, 0.190000, 1.000000);
- PlayerTextDrawColor(playerid, PlayerCoordinates, -1);
- PlayerTextDrawSetOutline(playerid, PlayerCoordinates, 1);
- PlayerTextDrawSetProportional(playerid, PlayerCoordinates, 1);
- PlayerTextDrawUseBox(playerid, PlayerCoordinates, 1);
- PlayerTextDrawBoxColor(playerid, PlayerCoordinates, 48);
- PlayerTextDrawTextSize(playerid, PlayerCoordinates, 0.000000, 191.000000);
- PlayerTextDrawShow(playerid, PlayerCoordinates);
- }
- else
- {
- svCoordinates_PlayerToggle[playerid] = false;
- PlayerTextDrawDestroy(playerid, PlayerCoordinates);
- }
- }
- #else
- if(svCoordinates_PlayerToggle[playerid] == false)
- {
- new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
- svCoordinates_PlayerToggle[playerid] = true;
- GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
- format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
- PlayerCoordinates = CreatePlayerTextDraw(playerid, 320.000000, 428.000000, string);
- PlayerTextDrawAlignment(playerid, PlayerCoordinates, 2);
- PlayerTextDrawBackgroundColor(playerid, PlayerCoordinates, 255);
- PlayerTextDrawFont(playerid, PlayerCoordinates, 2);
- PlayerTextDrawLetterSize(playerid, PlayerCoordinates, 0.190000, 1.000000);
- PlayerTextDrawColor(playerid, PlayerCoordinates, -1);
- PlayerTextDrawSetOutline(playerid, PlayerCoordinates, 1);
- PlayerTextDrawSetProportional(playerid, PlayerCoordinates, 1);
- PlayerTextDrawUseBox(playerid, PlayerCoordinates, 1);
- PlayerTextDrawBoxColor(playerid, PlayerCoordinates, 48);
- PlayerTextDrawTextSize(playerid, PlayerCoordinates, 0.000000, 191.000000);
- PlayerTextDrawShow(playerid, PlayerCoordinates);
- }
- else
- {
- svCoordinates_PlayerToggle[playerid] = false;
- PlayerTextDrawDestroy(playerid, PlayerCoordinates);
- }
- #endif
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment