[PEDIDO] Ajuda com comando / pickup
#1

Olб galera (:
Tenho um server de RPG, aquele que depende de ADM pra tudo, certo.
Tem a funзгo para setar o player na casa e criar um pickup onde ele foi setado, esses pickups salvam, desse jeito:
2632.969482, 2350.982421, 10.812772, //[BKs]Xeretta[VL]
Aqui sгo as coordenadas E aqui o nick
Queria saber e queria que me ajudassem a fazer junto com o pickup, aparecer um texto com o nome do dono da casa/dono do pickup, texto 3D, com a nova funзгo do 0.3, igual aquele FilterScript de propriedades do game mode "grandlarc":



Sei que й chato pedir tudo feito, mas nгo tenho ideia de como comeзar.
Meu comando й assim:
Code:
if(strcmp(cmd, "/vendercasa", true) == 0) {
      if(Profissao[playerid] == AJUDANTE || RconLogged2[playerid] == 1){
            new plid;
            new tmp[256];
            new nome[MAX_PLAYER_NAME];
            tmp = strtok(cmdtext, idx);
          if(!strlen(tmp)) {
                SendClientMessage(playerid, COLOR_RED, "/vendercasa [id]");
                return 1;
            }
            plid = strval(tmp);
            GetPlayerName(plid,nome,MAX_PLAYER_NAME);
        if (udb_Exists(nome)) {
            new Float:X, Float:Y, Float:Z;
            new File:temp;
            new string[256];
                GetPlayerPos(playerid, X, Y, Z);
                udb_setPosition(nome, X, Y, Z);
              udb_setAng(nome, 0);
              SendClientMessage(playerid, COLOR_GREEN, "Casa vendida");
                printf("%s acaba de vender um imуvel para %s",PlayerName(playerid),nome);
                format(string, sizeof(string), "%f, %f, %f, //%s\r\n", X, Y, Z, nome);
                temp = fopen("pickups.rpg", io_append);
                fwrite(temp, string);
                fclose(temp);
                AddStaticPickup(1273,1,X,Y,Z);
                LogarPlayer(plid);
              return 1;
      } else {
        SendClientMessage(playerid,COLOR_RED,"ERRO: ID invбlido, ou jogador nгo cadastrado.");
        return 1;
            }
        }
        else{
          SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem permissгo!");
            return 1;
        }
    }
Code:
OnGameModeInit
LoadPickups("pickups.rpg");
Code:
stock LoadPickups(pattern[])
{
    new tmp[256],File:temp,Float:X,Float:Y,Float:Z;
    if(!fexist(pattern)){
      dini_Create(pattern);
      return 1;
    }
    new string[256],index;
    temp = fopen(pattern, io_readwrite);
    while(fread(temp, tmp, sizeof(tmp), false)) {
        index = 0;
        X     = Float:floatstr(strtok(tmp, index));
        Y     = Float:floatstr(strtok(tmp, index));
        Z     = Float:floatstr(strtok(tmp, index));
        format(string, sizeof(string), "%f, %f, %f", X, Y, Z);
        AddStaticPickup(1273, 1, Float:X, Float:Y, Float:Z);
    }
    fclose(temp);
    return 1;
}
Alguйm tem a boa vontade de tentar me ajudar ? .__________.
Reply
#2

Substitua as funзхes, nгo esqueзa de alterar o valor de 'COR', que serб a cor do texto da pickup.

Criando...
pawn Code:
if(strcmp(cmd, "/vendercasa", true) == 0) {
      if(Profissao[playerid] == AJUDANTE || RconLogged2[playerid] == 1){
            new plid;
            new tmp[256];
            new nome[MAX_PLAYER_NAME];
            tmp = strtok(cmdtext, idx);
          if(!strlen(tmp)) {
                SendClientMessage(playerid, COLOR_RED, "/vendercasa [id]");
                return 1;
            }
            plid = strval(tmp);
            GetPlayerName(plid,nome,MAX_PLAYER_NAME);
        if (udb_Exists(nome)) {
            new Float:X, Float:Y, Float:Z;
            new File:temp;
            new string[256];
                GetPlayerPos(playerid, X, Y, Z);
                udb_setPosition(nome, X, Y, Z);
              udb_setAng(nome, 0);
              SendClientMessage(playerid, COLOR_GREEN, "Casa vendida");
                printf("%s acaba de vender um imуvel para %s",PlayerName(playerid),nome);
                format(string, sizeof(string), "%f, %f, %f, //%s\r\n", X, Y, Z, nome);
                temp = fopen("pickups.rpg", io_append);
                fwrite(temp, string);
                fclose(temp);
                AddStaticPickup(1273,1,X,Y,Z);
                format(string, sizeof(string), "Casa de %s", PlayerName(plid));
                Create3DTextLabel(string, COR, X, Y, Z+0.50, 25.0, 0);
                LogarPlayer(plid);
              return 1;
      } else {
        SendClientMessage(playerid,COLOR_RED,"ERRO: ID invбlido, ou jogador nгo cadastrado.");
        return 1;
            }
        }
        else{
          SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem permissгo!");
            return 1;
        }
    }
Carregando...
pawn Code:
stock LoadPickups(pattern[])
{
    new tmp[256],File:temp,Float:X,Float:Y,Float:Z;
    if(!fexist(pattern))
        {
      dini_Create(pattern);
      return 1;
    }
    new string[256], index, dono[256], cpos; //funзгo psf_SubstituirChar retorna 256
    temp = fopen(pattern, io_readwrite);
    while(fread(temp, tmp, sizeof(tmp), false))
        {
            index = 0;
            X = Float:floatstr(psf_strtok(tmp, index));
            Y = Float:floatstr(psf_strtok(tmp, index));
            Z = Float:floatstr(psf_strtok(tmp, index));
            cpos = psf_PosChar(tmp, "//", 1);
            psf_CopiarStrL(dono, tmp, cpos+2, strlen(tmp));
            dono = psf_SubstituirChar(dono, "\n", "");
            dono = psf_SubstituirChar(dono, "\r", "");
            AddStaticPickup(1273, 1, Float:X, Float:Y, Float:Z);
            print(string);
            Create3DTextLabel(string, COLOR_RED, X, Y, Z+0.50, 25.0, 0);
      }
    fclose(temp);
    return 1;
}
// funзгo correta...
Precisa do include PSF (http://forum.sa-mp.com/index.php?topic=132830.0).
Reply
#3

Nossa, valeu, vou testar *--*

Sem erros na compilaзгo, pegou corretamente, seta o player, aparece ele como dono no texto em cima do pickup, mas depois que reinicia o servidor, aparece as coordenadas ao invйs do nick, assim:
Reply
#4

Eu me distraн e coloquei outra funзгo no lugar... Mas sussa, esse aqui deve funcionar:

pawn Code:
stock LoadPickups(pattern[])
{
    new tmp[256],File:temp,Float:X,Float:Y,Float:Z;
    if(!fexist(pattern))
        {
      dini_Create(pattern);
      return 1;
    }
    new string[256], index, dono[256], cpos; //funзгo psf_SubstituirChar retorna 256
    temp = fopen(pattern, io_readwrite);
    while(fread(temp, tmp, sizeof(tmp), false))
        {
            index = 0;
            X = Float:floatstr(psf_strtok(tmp, index));
            Y = Float:floatstr(psf_strtok(tmp, index));
            Z = Float:floatstr(psf_strtok(tmp, index));
            cpos = psf_PosChar(tmp, "//", 1);
            psf_CopiarStrL(dono, tmp, cpos+2, strlen(tmp));
            dono = psf_SubstituirChar(dono, "\n", "");
            dono = psf_SubstituirChar(dono, "\r", "");
            AddStaticPickup(1273, 1, Float:X, Float:Y, Float:Z);
            format(string, sizeof(string), "Casa de %s", dono);
            Create3DTextLabel(string, COLOR_RED, X, Y, Z+0.50, 25.0, 0);
      }
    fclose(temp);
    return 1;
}
Editei a bagaзa...
Reply
#5

Agora nгo aparece o texto
Reply
#6

Aparece sim velho, copiou direito a funзгo? Tenta de novo...
Reply
#7

Agora apareceu, devo ter feito alguma merda, valeu cara, valeu mesmo ._.
Reply
#8

Muito bom mas eu tambem preciso de uma ajuda
eu queria que ficase com o id da casa
ex: casa ID 0 eu fiz quando eu crio a casa aparece o 3DTextLabel normal
mas quando eu relogo o servidor some o 3DTextLabel so fica o Pickup da casa
alguem pode me ajudar
obrigado
Reply
#9

Muito bom, mas eu tambem queria por interior, tipo:
Fica o pickup, o 3DTextLabel..
sу que quando o player passa no pickup apareзa uma mensagem para ele,
Para entrar na casa digite "xxx"
tipo : /vendercasa [ID] [INT]
Alguem ajuda eol? .-.
Reply
#10

OnPlayerPickUpPickup
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)