[Pedido] Tutorial mostrar altitude no velocimetro PPC_Trucking
#1

bom galera auguem ajuda ? ++Rep
Reply
#2

Putz.
pawn Код:
new Float:pN[3], Altitude[20];
GetPlayerPos(playerid, pN[0], pN[1], pN[2]);
format(Altitude, 20, "Alt: %4.2f", pN[2]);
Uma 'base' aн.
Reply
#3

Nick este seu cуdigo nгo vai mostrar a altitude do player a partir do solo do mapa .

Seria necessбrio o MapAndreas , eu acho ...
Reply
#4

Quote:
Originally Posted by darkxdll
Посмотреть сообщение
Nick este seu cуdigo nгo vai mostrar a altitude do player a partir do solo do mapa .

Seria necessбrio o MapAndreas , eu acho ...
Altitude se define a partir do nivel do mar. Pegar a posiзгo 'Z' de uma float irб mostrar isso.
Reply
#5

Quote:
Originally Posted by darkxdll
Посмотреть сообщение
Nick este seu cуdigo nгo vai mostrar a altitude do player a partir do solo do mapa .

Seria necessбrio o MapAndreas , eu acho ...
Altura = A partir do solo.
Altitude = A partir do nнvel do mar.


O ъltimo parвmetro de GetPlayerPos й referente а altitude, se vocк precisasse de altura, aн sim o MapAndreas seria ъtil.


Й possнvel estar a 1 metro de altura, estando a 1000 de altitude.
Se vocк nгo mora no litoral, isso acontece o tempo todo.
Reply
#6

Nгo ofereзa +rep por cуdigos, isso nгo й dinheiro, e isso nгo nos faz estar aqui para ajudar




@OnTopic: Como fazer isso й bem simples.
1 - Criar uma nova textdraw. (TextDrawCreate)
2 - Obter as coordenadas da posiзгo do do jogador. (GetPlayerPos)
3 - Formatar um string com os valores flutuantes da posiзгo. (format)
4 - Definir a textdraw com o texto formatado. (TextDrawSetString)
5 - Exibir a textdraw para o jogador. (TextDrawShowForPlayer)

Estude este sistema que й muito usado Zamaroth TextDrawEditor
http://pastebin.com/R99HVMLC


Aqui outro sistema com textdraw's pra vocк estudar.
pawn Код:
/*  infotextdraw.pwn
 *
 *  © Copyright 2009, Emilio "Correlli" Lovriж
 *
 */


#include "a_samp"

forward Float:GetPlayerPosX(playerid);
forward Float:GetPlayerPosY(playerid);
forward Float:GetPlayerPosZ(playerid);
forward Float:PlayerAngle(playerid);

new
        Text:InfoTextDraw[MAX_PLAYERS][2], bool:isInfoTDCreated[MAX_PLAYERS],
        textdrawString[256];

public OnFilterScriptInit()
{
    for(new u = 0; u < MAX_PLAYERS; u++)
    {
        if(IsPlayerConnected(u)) CreatePlayerInfo(u);
    }
    printf("-> Information textdraw filterscript v1.0 by Emilio \"Correlli\" Lovric  is loaded!");
    return true;
}

public OnFilterScriptExit()
{
    for(new u = 0; u < MAX_PLAYERS; u++)
    {
        if(IsPlayerConnected(u)) DestroyPlayerInfo(u);
    }
    printf("-> Information textdraw filterscript v1.0 by Emilio \"Correlli\" Lovric is unloaded!");
    return true;
}

public OnPlayerConnect(playerid)
{
    CreatePlayerInfo(playerid);
    return true;
}

public OnPlayerDisconnect(playerid, reason)
{
    DestroyPlayerInfo(playerid);
    return true;
}

public OnPlayerUpdate(playerid)
{
    format(textdrawString, 256,
        "~g~Information:\
         ~n~~r~Name: ~y~%s\
         ~n~~r~IP: ~y~%s\
         ~n~~r~Ping: ~y~%i\
         ~n~~r~Health: ~y~%i\
         ~n~~r~Armor: ~y~%i\
         ~n~~r~State: ~y~%s\
         ~n~~r~Money: ~y~$%i,00"
,
            PlayerName(playerid),
            PlayerIp(playerid),
            GetPlayerPing(playerid),
            PlayerHealth(playerid),
            PlayerArmor(playerid),
            PlayerStateName(playerid),
            GetPlayerMoney(playerid));
    UpdatePlayerInfo(0, playerid, textdrawString);

    format(textdrawString, 256,
        "~n~~n~~n~~n~~n~~n~~n~\
         ~n~~r~Position X: ~y~%.3f\
         ~n~~r~Position Y: ~y~%.3f\
         ~n~~r~Position Z: ~y~%.3f\
         ~n~~r~Angle: ~y~%.3f\
         ~n~~r~Interior-ID: ~y~%i\
         ~n~~r~VirtualWorld-ID: ~y~%i"
,
            GetPlayerPosX(playerid),
            GetPlayerPosY(playerid),
            GetPlayerPosZ(playerid),
            PlayerAngle(playerid),
            GetPlayerInterior(playerid),
            GetPlayerVirtualWorld(playerid));
    UpdatePlayerInfo(1, playerid, textdrawString);
    return true;
}

/*----------------------------------------------------------------------------*/

stock CreatePlayerInfo(playerid)
{
    // first text-draw.
    InfoTextDraw[playerid][0] = TextDrawCreate(10.000000, 132.000000, "Information textdraw 1");
    TextDrawTextSize(InfoTextDraw[playerid][0], 605.000000, 0.000000);
    TextDrawAlignment(InfoTextDraw[playerid][0], 0);
    TextDrawBackgroundColor(InfoTextDraw[playerid][0], 0x000000ff);
    TextDrawFont(InfoTextDraw[playerid][0], 1);
    TextDrawLetterSize(InfoTextDraw[playerid][0], 0.299999, 1.000000);
    TextDrawColor(InfoTextDraw[playerid][0], 0x00ffffff);
    TextDrawSetProportional(InfoTextDraw[playerid][0], 1);
    TextDrawSetShadow(InfoTextDraw[playerid][0], 1);
    // second text-draw.
    InfoTextDraw[playerid][1] = TextDrawCreate(10.000000, 132.000000, "Information textdraw 2");
    TextDrawTextSize(InfoTextDraw[playerid][1], 605.000000, 0.000000);
    TextDrawAlignment(InfoTextDraw[playerid][1], 0);
    TextDrawBackgroundColor(InfoTextDraw[playerid][1], 0x000000ff);
    TextDrawFont(InfoTextDraw[playerid][1], 1);
    TextDrawLetterSize(InfoTextDraw[playerid][1], 0.299999, 1.000000);
    TextDrawColor(InfoTextDraw[playerid][1], 0x00ffffff);
    TextDrawSetProportional(InfoTextDraw[playerid][1], 1);
    TextDrawSetShadow(InfoTextDraw[playerid][1], 1);
    isInfoTDCreated[playerid] = true;
    return true;
}

stock DestroyPlayerInfo(playerid)
{
    if(isInfoTDCreated[playerid] == true)
    {
        TextDrawDestroy(InfoTextDraw[playerid][0]);
        TextDrawDestroy(InfoTextDraw[playerid][1]);
        isInfoTDCreated[playerid] = false;
    }
    return true;
}

stock ShowPlayerInfo(playerid)
{
    TextDrawShowForPlayer(playerid, InfoTextDraw[playerid][0]);
    TextDrawShowForPlayer(playerid, InfoTextDraw[playerid][1]);
    return true;
}

stock HidePlayerInfo(playerid)
{
    TextDrawHideForPlayer(playerid, InfoTextDraw[playerid][0]);
    TextDrawHideForPlayer(playerid, InfoTextDraw[playerid][1]);
    return true;
}

stock UpdatePlayerInfo(id, playerid, content[])
{
    if(isInfoTDCreated[playerid] == true)
    {
        if(id == 0 || id == 1)
        {
            TextDrawSetString(InfoTextDraw[playerid][id], content);
            TextDrawShowForPlayer(playerid, InfoTextDraw[playerid][id]);
        }
        return false;
    }
    return true;
}

/*----------------------------------------------------------------------------*/

stock PlayerName(playerid)
{
    new
            name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}

stock PlayerIp(playerid)
{
    new
            ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));
    return ip;
}

stock PlayerHealth(playerid)
{
    new
            Float:health;
    GetPlayerHealth(playerid, health);
    return floatround(health);
}

stock PlayerArmor(playerid)
{
    new
            Float:armor;
    GetPlayerArmour(playerid, armor);
    return floatround(armor);
}

stock PlayerStateName(playerid)
{
    new
            statename[32];
    switch(GetPlayerState(playerid))
    {
        case PLAYER_STATE_NONE: statename = "on foot";
        case PLAYER_STATE_ONFOOT: statename = "on foot";
        case PLAYER_STATE_DRIVER: statename = "driver in the vehicle";
        case PLAYER_STATE_PASSENGER: statename = "passenger in the vehicle";
        case PLAYER_STATE_WASTED: statename = "wasted";
        case PLAYER_STATE_SPAWNED: statename = "spawned";
        case PLAYER_STATE_SPECTATING: statename = "spectating";
        default: statename = "unknown state";
    }
    return statename;
}

Float:GetPlayerPosX(playerid)
{
    new
            Float:get_x, Float:get_y, Float:get_z;
    GetPlayerPos(playerid, get_x, get_y, get_z);
    return get_x;
}

Float:GetPlayerPosY(playerid)
{
    new
            Float:get_x, Float:get_y, Float:get_z;
    GetPlayerPos(playerid, get_x, get_y, get_z);
    return get_y;
}

Float:GetPlayerPosZ(playerid)
{
    new
            Float:get_x, Float:get_y, Float:get_z;
    GetPlayerPos(playerid, get_x, get_y, get_z);
    return get_z;
}

Float:PlayerAngle(playerid)
{
    new
            Float:playerangle;
    GetPlayerFacingAngle(playerid, playerangle);
    return playerangle;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)