3DTextLabel problem
#1

i have a buyable store system the problem is when u buy store your name will be on 3DTextLabel but after buy store if u reload store your name will be null.
sorry for my english.
PHP код:
Function OnStoreLoad()
{
    new 
        
0,
        
i,
        
s[64]
    ;
    for(new 
xx cache_get_row_count(); xxx++)
    {
        
Iter_Free(Stores);
        
Store[i][StoreID] = cache_get_field_content_int(x"id");
        
Store[i][StoreX] = cache_get_field_content_float(x"x");
        
Store[i][StoreY] = cache_get_field_content_float(x"y");
        
Store[i][StoreZ] = cache_get_field_content_float(x"z");
        
Store[i][StoreA] = cache_get_field_content_float(x"angle");
        
Store[i][StoreInteriorID] = cache_get_field_content_int(x"interiorid");
        
cache_get_field_content(x"name"s);
        
format(Store[i][StoreName], 64"%s"s);
        
Store[i][StoreMoney] = cache_get_field_content_int(x"money");
        
Store[i][StoreMoneyPerDay] = cache_get_field_content_int(x"mpd");
        
Store[i][StorePrice] = cache_get_field_content_int(x"price");
        
Store[i][StoreLevel] = cache_get_field_content_int(x"level");
        
Store[i][StoreIconID] = cache_get_field_content_int(x"mapicon");
        
Store[i][StoreOwner] = cache_get_field_content_int(x"owner");
        
Store[i][StoreIcon] = CreateDynamicMapIcon(Store[i][StoreX], Store[i][StoreY], Store[i][StoreZ], Store[i][StoreIconID], -100, .style MAPICON_GLOBAL);
        
Store[i][StoreEnterPickup] = CreateDynamicPickup(13181Store[i][StoreX], Store[i][StoreY], Store[i][StoreZ], 00, -135.0);
        new 
intid IsInteriorExist(Store[i][StoreInteriorID]), label[256];
        
cache_get_field_content(x"username"s);
        if(
Store[i][StorePrice] == 1337)
            
format(label256"{FF0000}[%s]\n{FFFFFF}{FFFF66}ID: {FFFFFF}%d\n{FFFF66}Owner: {FFFFFF}The Government"Store[i][StoreName], Store[i][StoreID]);
        else if(
Store[i][StoreOwner] == 0)
            
format(label256"{FF0000}[%s]\n{FFFFFF}{FFFF66}ID: {FFFFFF}%d\n{FFFF66}Owner: {FFFFFF}Unowned\n{FFFF66}Price: {FFFFFF}$%m\n{FFFF66}Level: {FFFFFF}%d\n{FFFF66}$%m per gameday"Store[i][StoreName], Store[i][StoreID], Store[i][StorePrice], Store[i][StoreLevel], Store[i][StoreMoneyPerDay]);
        else
            
format(label256"{FF0000}[%s]\n{FFFFFF}{FFFF66}ID: {FFFFFF}%d\n{FFFF66}Owner: {FFFFFF}%s\n{FFFF66}Price: {FFFFFF}$%m\n{FFFF66}Level: {FFFFFF}%d\n{FFFF66}$%m per gameday"Store[i][StoreName], Store[i][StoreID], sStore[i][StorePrice], Store[i][StoreLevel], Store[i][StoreMoneyPerDay]);
        
Store[i][StoreStatus] = STORE_IDLE;
        
Store[i][StoreSafe] = CreateSafe(Interior[intid][InteriorSafeID], Store[i][StoreID]);
        
Store[i][StoreExitCP] = CreateDynamicCP(Interior[intid][InteriorX], Interior[intid][InteriorY], Interior[intid][InteriorZ], 1.0Store[i][StoreID], Interior[intid][InteriorIntID]);
        
Store[i][StoreEnterLabel] = CreateDynamic3DTextLabel(label, -1Store[i][StoreX], Store[i][StoreY], Store[i][StoreZ], 10.0, .worldid 0, .interiorid 0);
        
UpdateDynamic3DTextLabelText(Store[i][StoreEnterLabel], -1label);
        
Store[i][StoreRobberyCP] = CreateSafeCP(Interior[intid][InteriorSafeID], Store[i][StoreID]);
        
Store[i][StoreRobberyLabel] = CreateRobberyLabel(Interior[intid][InteriorSafeID], Store[i][StoreID]);
        
Store[i][StoreActor] = CreateActor(Interior[intid][InteriorActorSkin], Interior[intid][InteriorActorX], Interior[intid][InteriorActorY], Interior[intid][InteriorActorZ], Interior[intid][InteriorActorA]);
        switch(
random(4))
        {
            case 
0:
                
ApplyActorAnimation(Store[i][StoreActor], "PED""roadcross"4.111110);
            case 
1:
                
ApplyActorAnimation(Store[i][StoreActor], "PED""roadcross_female"4.111110);
            case 
2:
                
ApplyActorAnimation(Store[i][StoreActor], "PED","roadcross_gang"4.111110);
            case 
3:
                
ApplyActorAnimation(Store[i][StoreActor], "PED","roadcross_old"4.111110);
        }
        
SetActorVirtualWorld(Store[i][StoreActor], Store[i][StoreID]);
        
Iter_Add(Storesi);
    }
    return;
}
ReloadStore()
{
    foreach(new 
Stores)
    {
        
DestroyDynamicMapIcon(Store[i][StoreIcon]);
        
DeleteSafe(Store[i][StoreSafe]);
        
DestroyDynamicCP(Store[i][StoreExitCP]);
        
DestroyDynamicCP(Store[i][StoreRobberyCP]);
        
DestroyDynamic3DTextLabel(Store[i][StoreRobberyLabel]);
        
DestroyDynamic3DTextLabel(Store[i][StoreEnterLabel]);
        
DestroyDynamicPickup(Store[i][StoreEnterPickup]);
        
DestroyActor(Store[i][StoreActor]);
    }
    
Iter_Clear(Stores);
    
mysql_tquery(connectionHandle"SELECT * FROM `store`""OnStoreLoad");

Reply
#2

I think the problem is about your buy store cmd. Maybe it didn't update store owner's name.
Post your buy store cmd code.
Reply
#3

Quote:
Originally Posted by noxno0609
Посмотреть сообщение
I think the problem is about your buy store cmd. Maybe it didn't update store owner's name.
Post your buy store cmd code.
PHP код:
COMMAND:buystore(playeridparams[])
{
    foreach(new 
Stores)
    {
        if(
Store[i][StoreOwner] == pData[playerid][RealID])
            return 
Message(playeridCOLOR_RED"You can't buy more stores");
    }
    if(
GetPlayerScore(playerid) >= 1000)
    {
        new 
ibool:found false;
        if(
sscanf(params"d"i))
            return 
Usage(playerid"buystore [storeid]");
        foreach(new 
Stores)
        {
            if(
Store[x][StoreID] == i)
            {
                
x;
                
found true;
                break;
            }
        }
        if(!
found)
            return 
1;
        if(!
Store[i][StoreOwner])
        {
            if(
Store[i][StorePrice] == 1337)
                return 
1;
            if(
GetPlayerMoney(playerid) >= Store[i][StorePrice])
            {
                
GivePlayerMoney(playerid, -Store[i][StorePrice]);
                
Store[i][StoreOwner] = pData[playerid][RealID];
                
Message(playeridCOLOR_GREEN"You bought %s for $%m, use /storemenu while inside store to access store menu"Store[i][StoreName], Store[i][StorePrice]);
                new 
label[256];
                
format(label256"{FF0000}[%s]\n{FFFFFF}{FFFF66}ID: {FFFFFF}%d\n{FFFF66}Owner: {FFFFFF}%p\n{FFFF66}Price: {FFFFFF}$%m\n{FFFF66}Level: {FFFFFF}%d\n{FFFF66}$%m per gameday"Store[i][StoreName], Store[i][StoreID], playeridStore[i][StorePrice], Store[i][StoreLevel], CountMoneyPerDay(i));
                
UpdateDynamic3DTextLabelText(Store[i][StoreEnterLabel], -1label);
                
mysql_format(connectionHandlelabel256"UPDATE store SET owner = %d WHERE id = %d"pData[playerid][RealID], Store[i][StoreID]);
                
mysql_query(connectionHandlelabelfalse);
            }
            else
                
Message(playeridCOLOR_RED"Not enough money to buy this store");
        }
        else
            
Message(playeridCOLOR_RED"This store is owned");
    }
    else
        
Message(playeridCOLOR_RED"You must have 1000 score or more as a requirement to buy any store");
    return 
1;

Reply
#4

Help me guys plz
Reply
#5

Try this please

Код:
COMMAND:buystore(playerid, params[]) 
{ 
    foreach(new i : Stores) 
    { 
        if(Store[i][StoreOwner] == pData[playerid][RealID]) 
            return Message(playerid, COLOR_RED, "You can't buy more stores"); 
    } 
    if(GetPlayerScore(playerid) >= 1000) 
    { 
        new i, bool:found = false; 
        if(sscanf(params, "d", i)) 
            return Usage(playerid, "buystore [storeid]"); 

        foreach(new x : Stores) 
        { 
            if(Store[x][StoreID] == i) 
            { 
                i = x; 
                found = true; 
                break; 
            } 
        } 

        if(!found) 
            return 1; 

        if(!Store[i][StoreOwner]) 
        { 
            if(Store[i][StorePrice] == 1337) 
                return 1; 

            if(GetPlayerMoney(playerid) >= Store[i][StorePrice]) 
            { 
                GivePlayerMoney(playerid, -Store[i][StorePrice]); 
                Store[i][StoreOwner] = pData[playerid][RealID]; 
                Message(playerid, COLOR_GREEN, "You bought %s for $%m, use /storemenu while inside store to access store menu", Store[i][StoreName], Store[i][StorePrice]); 
                new label[256]; 
                format(label, 256, "{FF0000}[%s]\n{FFFFFF}{FFFF66}ID: {FFFFFF}%d\n{FFFF66}Owner: {FFFFFF}%d\n{FFFF66}Price: {FFFFFF}$%m\n{FFFF66}Level: {FFFFFF}%d\n{FFFF66}$%m per gameday", Store[i][StoreName], Store[i][StoreID], playerid, Store[i][StorePrice], Store[i][StoreLevel], CountMoneyPerDay(i)); 
                UpdateDynamic3DTextLabelText(Store[i][StoreEnterLabel], -1, label); 
                mysql_format(connectionHandle, label, 256, "UPDATE store SET owner = %d WHERE id = %d", pData[playerid][RealID], Store[i][StoreID]); 
                mysql_query(connectionHandle, label, false); 
            } 
            else 
                Message(playerid, COLOR_RED, "Not enough money to buy this store"); 
        } 
        else 
            Message(playerid, COLOR_RED, "This store is owned"); 
    } 
    else 
        Message(playerid, COLOR_RED, "You must have 1000 score or more as a requirement to buy any store"); 
    return 1; 
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)