SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 12/06/2018, 04:39 PM   #1
iWiNeR
Big Clucker
 
Join Date: Dec 2014
Location: Brasil
Posts: 129
Reputation: 0
Default string

HeyGuys, estou com um problema em meu sistema de casas, em que ocorre o seguinte é carregado um 3dtextlabel exibindo, ID da casa e o DONO, o problema está quando ele exibe o dono a primeira casa carrega normalmente, ja a segunda exibe o dono da primeira e a dela ficando por exemplo assim: DONO : Joazinho Mariazinha e assim por diante na terceira aparece Joazinho Mariazinha Bugzinho. Desde já agradeço a ajuda

PHP Code:
CarregarCasa(casas)
{
        new 
query[250];
        new 
dono[64];
        for(new 
0MAX_CASASc++)
        {
            
format(querysizeof(query), "Casas/Casa%d.ini"c);
        
            
houseData[c][houseX] = DOF2_GetFloat(query"PosX");
            
houseData[c][houseY] = DOF2_GetFloat(query"PosY");
            
houseData[c][houseZ] = DOF2_GetFloat(query"PosZ");
            
strcat(donoDOF2_GetString(query"Dono"));
            
houseData[c][Dono] = dono;
            
houseData[c][PrecoH] = DOF2_GetInt(query"Preco");
            
houseData[c][CasaID] = DOF2_GetInt(query"CasaId");

            
CreateDynamicPickup(12731houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], -1, -1, -13.0);

            
format(STRXsizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d"houseData[c][Dono],c);
            
CreateDynamic3DTextLabel(STRX, -1houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0INVALID_PLAYER_IDINVALID_VEHICLE_ID1, -1, -1, -13.0);

        }
        return 
1;

__________________
Code:
   Space RP
iWiNeR is offline   Reply With Quote
Old 12/06/2018, 04:45 PM   #2
Minerva
Big Clucker
 
Minerva's Avatar
 
Join Date: Apr 2018
Location: Olhe para trás
Posts: 76
Reputation: 1
Default Re: string

Leia isso: http://wiki.sa-mp.com/wiki/Strcat

PHP Code:
format(houseData[c][Dono], 24DOF2_GetString(query"Dono")); 
Espero ter ajudado
__________________
Novato em pawn
Discord:
Minerva#1520
Minerva is online now   Reply With Quote
Old 12/06/2018, 04:55 PM   #3
iWiNeR
Big Clucker
 
Join Date: Dec 2014
Location: Brasil
Posts: 129
Reputation: 0
Default Re: string

Quote:
Originally Posted by Minerva View Post
Leia isso: http://wiki.sa-mp.com/wiki/Strcat

PHP Code:
format(houseData[c][Dono], 24DOF2_GetString(query"Dono")); 
Espero ter ajudado
Ja testei dessa forma, porém sem resultado
__________________
Code:
   Space RP
iWiNeR is offline   Reply With Quote
Old 12/06/2018, 05:04 PM   #4
Ermanhaut
Huge Clucker
 
Ermanhaut's Avatar
 
Join Date: Apr 2016
Location: Curitiba, PR
Posts: 361
Reputation: 19
Default Re: string

Code:
format(houseData[c][Dono], 24, "%s", DOF2_GetString(query, "Dono"));
Tente isto..
(Sei que é a mesma coisa que só colocar a função do DOF2 ali, mas sei lá né)
__________________
_

"It's only after we've lost everything that we're free to do anything"
Fight Club(1999)
Ermanhaut is online now   Reply With Quote
Old 13/06/2018, 12:09 AM   #5
AutoMatic2
Big Clucker
 
Join Date: Apr 2018
Posts: 114
Reputation: 2
Wink Re: string

PHP Code:
new Text3D:LabelCasa[MAX_CASAS];

CarregarCasa(casas)
{
    new 
query[250];
    new 
dono[64];
    new 
PickupId;
    
    for(new 
0MAX_CASASc++)
     {
        
format(querysizeof(query), "Casas/Casa%d.ini"c);

        
houseData[c][houseX] = DOF2_GetFloat(query"PosX");
        
houseData[c][houseY] = DOF2_GetFloat(query"PosY");
        
houseData[c][houseZ] = DOF2_GetFloat(query"PosZ");
        
houseData[c][Dono] = DOF2_GetString(query"Dono"));
        
houseData[c][PrecoH] = DOF2_GetInt(query"Preco");
        
houseData[c][CasaID] = DOF2_GetInt(query"CasaId");

        
PickupId CreateDynamicPickup(12731houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], -1, -1, -13.0);
        
DOF2_SetInt(query"PickupId"PickupId);

        
format(STRXsizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d"houseData[c][Dono], c);
        
LabelCasa[c] = CreateDynamic3DTextLabel(STRX, -1houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0INVALID_PLAYER_IDINVALID_VEHICLE_ID1, -1, -1, -13.0);
    }
    return 
1;

tenta assim, eu uso DOF2_GetString(query, "Dono")
mas acho que assim tbm da acho que falto o LabelCasa

esse carregar casa se vc for colocar no OnGameModeInit a minha e outra função que so carrega:

Pickup, mapicon é TextLabel o resto carrega sem erros e conflitos
AutoMatic2 is offline   Reply With Quote
Old 13/06/2018, 04:45 PM   #6
iWiNeR
Big Clucker
 
Join Date: Dec 2014
Location: Brasil
Posts: 129
Reputation: 0
Default Re: string

Quote:
Originally Posted by AutoMatic2 View Post
PHP Code:
new Text3D:LabelCasa[MAX_CASAS];

CarregarCasa(casas)
{
    new 
query[250];
    new 
dono[64];
    new 
PickupId;
    
    for(new 
0MAX_CASASc++)
     {
        
format(querysizeof(query), "Casas/Casa%d.ini"c);

        
houseData[c][houseX] = DOF2_GetFloat(query"PosX");
        
houseData[c][houseY] = DOF2_GetFloat(query"PosY");
        
houseData[c][houseZ] = DOF2_GetFloat(query"PosZ");
        
houseData[c][Dono] = DOF2_GetString(query"Dono"));
        
houseData[c][PrecoH] = DOF2_GetInt(query"Preco");
        
houseData[c][CasaID] = DOF2_GetInt(query"CasaId");

        
PickupId CreateDynamicPickup(12731houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], -1, -1, -13.0);
        
DOF2_SetInt(query"PickupId"PickupId);

        
format(STRXsizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d"houseData[c][Dono], c);
        
LabelCasa[c] = CreateDynamic3DTextLabel(STRX, -1houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0INVALID_PLAYER_IDINVALID_VEHICLE_ID1, -1, -1, -13.0);
    }
    return 
1;

tenta assim, eu uso DOF2_GetString(query, "Dono")
mas acho que assim tbm da acho que falto o LabelCasa

esse carregar casa se vc for colocar no OnGameModeInit a minha e outra função que so carrega:

Pickup, mapicon é TextLabel o resto carrega sem erros e conflitos
Dessa forma funcionou, porém gerou outro bug, quando atualiza o 3DTextLabel ele fica sobreposto com o antigo em vez de atualizar
__________________
Code:
   Space RP
iWiNeR is offline   Reply With Quote
Old 13/06/2018, 04:52 PM   #7
Ermanhaut
Huge Clucker
 
Ermanhaut's Avatar
 
Join Date: Apr 2016
Location: Curitiba, PR
Posts: 361
Reputation: 19
Default Re: string

Quote:
Originally Posted by iWiNeR View Post
Dessa forma funcionou, porém gerou outro bug, quando atualiza o 3DTextLabel ele fica sobreposto com o antigo em vez de atualizar
Você tem que checar se há uma textdraw criada para aquela casa, se há, você deve atualiza-la, não criar outra.

Code:
new Text3D:LabelCasa[MAX_CASAS]; 

CarregarCasa(casas) 
{ 
    new query[250]; 
    new dono[64]; 
    new PickupId; 
     
    for(new c = 0; c < MAX_CASAS; c++) 
     { 
        format(query, sizeof(query), "Casas/Casa%d.ini", c); 

        houseData[c][houseX] = DOF2_GetFloat(query, "PosX"); 
        houseData[c][houseY] = DOF2_GetFloat(query, "PosY"); 
        houseData[c][houseZ] = DOF2_GetFloat(query, "PosZ"); 
        houseData[c][Dono] = DOF2_GetString(query, "Dono")); 
        houseData[c][PrecoH] = DOF2_GetInt(query, "Preco"); 
        houseData[c][CasaID] = DOF2_GetInt(query, "CasaId"); 

        PickupId = CreateDynamicPickup(1273, 1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], -1, -1, -1, 3.0); 
        DOF2_SetInt(query, "PickupId", PickupId); 

        format(STRX, sizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d", houseData[c][Dono], c);
        if(LabelCasa[c] == Text3D:INVALID_3DTEXT_ID) {
            LabelCasa[c] = CreateDynamic3DTextLabel(STRX, -1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 3.0); 
        }
        else {
            Update3DTextLabelText(LabelCasa[c], -1, STRX);
        }
    } 
    return 1; 
}
__________________
_

"It's only after we've lost everything that we're free to do anything"
Fight Club(1999)
Ermanhaut is online now   Reply With Quote
Old 13/06/2018, 05:12 PM   #8
iWiNeR
Big Clucker
 
Join Date: Dec 2014
Location: Brasil
Posts: 129
Reputation: 0
Default Re: string

Quote:
Originally Posted by Ermanhaut View Post
Você tem que checar se há uma textdraw criada para aquela casa, se há, você deve atualiza-la, não criar outra.

Code:
new Text3D:LabelCasa[MAX_CASAS]; 

CarregarCasa(casas) 
{ 
    new query[250]; 
    new dono[64]; 
    new PickupId; 
     
    for(new c = 0; c < MAX_CASAS; c++) 
     { 
        format(query, sizeof(query), "Casas/Casa%d.ini", c); 

        houseData[c][houseX] = DOF2_GetFloat(query, "PosX"); 
        houseData[c][houseY] = DOF2_GetFloat(query, "PosY"); 
        houseData[c][houseZ] = DOF2_GetFloat(query, "PosZ"); 
        houseData[c][Dono] = DOF2_GetString(query, "Dono")); 
        houseData[c][PrecoH] = DOF2_GetInt(query, "Preco"); 
        houseData[c][CasaID] = DOF2_GetInt(query, "CasaId"); 

        PickupId = CreateDynamicPickup(1273, 1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], -1, -1, -1, 3.0); 
        DOF2_SetInt(query, "PickupId", PickupId); 

        format(STRX, sizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d", houseData[c][Dono], c);
        if(LabelCasa[c] == Text3D:INVALID_3DTEXT_ID) {
            LabelCasa[c] = CreateDynamic3DTextLabel(STRX, -1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 3.0); 
        }
        else {
            Update3DTextLabelText(LabelCasa[c], -1, STRX);
        }
    } 
    return 1; 
}
Dessa forma ela nem é carregada
__________________
Code:
   Space RP
iWiNeR is offline   Reply With Quote
Old 13/06/2018, 09:09 PM   #9
AutoMatic2
Big Clucker
 
Join Date: Apr 2018
Posts: 114
Reputation: 2
Wink Re: string

Tenta assim:

PHP Code:
format(STRXsizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d"houseData[c][Dono], c);
UpdateDynamic3DTextLabelText(LabelCasa[c], BrancoSTRX); 
espero que n haja outro bug com UpdateDynamic3DTextLabelText

ou assim:

PHP Code:
if(LabelCasa[c] == Text3D:INVALID_3DTEXT_ID)
{
    
LabelCasa[c] = CreateDynamic3DTextLabel(STRX, -1houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0INVALID_PLAYER_IDINVALID_VEHICLE_ID1, -1, -1, -13.0);
}
else
{
    
UpdateDynamic3DTextLabelText(LabelCasa[c], BrancoSTRX);

AutoMatic2 is offline   Reply With Quote
Old 13/06/2018, 09:24 PM   #10
iWiNeR
Big Clucker
 
Join Date: Dec 2014
Location: Brasil
Posts: 129
Reputation: 0
Default Re: string

Quote:
Originally Posted by AutoMatic2 View Post
Tenta assim:

PHP Code:
format(STRXsizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d"houseData[c][Dono], c);
UpdateDynamic3DTextLabelText(LabelCasa[c], BrancoSTRX); 
espero que n haja outro bug com UpdateDynamic3DTextLabelText

ou assim:

PHP Code:
if(LabelCasa[c] == Text3D:INVALID_3DTEXT_ID)
{
    
LabelCasa[c] = CreateDynamic3DTextLabel(STRX, -1houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0INVALID_PLAYER_IDINVALID_VEHICLE_ID1, -1, -1, -13.0);
}
else
{
    
UpdateDynamic3DTextLabelText(LabelCasa[c], BrancoSTRX);

Continua sobreposto o Update acontece em outro comando, não se se isso interfere em algo
__________________
Code:
   Space RP
iWiNeR is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
input line too long (after substitutions) invalid string (possibly non-terminated string) StackedPizza Scripting Help 4 09/11/2016 02:34 AM
error 037: invalid string (possibly non-terminated string) Patrick Scripting Help 9 06/03/2013 05:53 PM
string too small. but i dont wanna make the string like 9999.. niels44 Scripting Help 3 23/10/2012 05:36 PM
input line too long (after substitutions) - invalid string (possibly non-terminated string) MahmutBey Help Archive 7 10/03/2011 02:02 PM


All times are GMT. The time now is 05:40 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.