SA-MP Forums Archive
Помогите с домами! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Русский/Russian (https://sampforum.blast.hk/forumdisplay.php?fid=32)
+---- Thread: Помогите с домами! (/showthread.php?tid=474919)



Помогите с домами! - Nadim - 10.11.2013

Мне нужно добавить такую вещь:
Если в строке "Owner" (хозяин) стоит "HouseForSale" тогда иконка дома зелёная, а если там написан ник хозяина тогда там синяя иконка!

Вот мой код:
PHP код:
enum hHouse
{
    
Float:XpicV,
    
Float:YpicV,
    
Float:ZpicV,
    
Float:XspawnV,
    
Float:YspawnV,
    
Float:ZspawnV,
    
Float:XpicE,
    
Float:YpicE,
    
Float:ZpicE,
    
Float:XspawnE,
    
Float:YspawnE,
    
Float:ZspawnE,
    
Interior,
    
PickupV,
    
PickupE,
    
Owner,
};
new 
bool:HouseInfo[MAX_HOUSES][hHouse];
stock LoadHouse() // OnGameModInit()
{
    print(
"\nÇàãðóçêà äîìîâ íà÷èíàåòñÿ:\n");
    new 
hcount=false;
    for(new 
h=false;h<MAX_HOUSES;h++)
    {
        new 
string[24];
        
format(string,sizeof(string),"House/%d.ini",h);
        new 
iniFile ini_openFile(string);
        if(
fexist(string))
        {
            
ini_getFloat(iniFile,"XpicV",HouseInfo[h][XpicV]);
            
ini_getFloat(iniFile,"YpicV",HouseInfo[h][YpicV]);
            
ini_getFloat(iniFile,"ZpicV",HouseInfo[h][ZpicV]);
            
ini_getFloat(iniFile,"XpicE",HouseInfo[h][XpicE]);
            
ini_getFloat(iniFile,"YpicE",HouseInfo[h][YpicE]);
            
ini_getFloat(iniFile,"ZpicE",HouseInfo[h][ZpicE]);
            
ini_getString(iniFile,"Owner",HouseInfo[h][Owner]);
            
ini_closeFile(iniFile);
            
HouseInfo[h][PickupV] = CreatePickup(1272,23,HouseInfo[h][XpicV],HouseInfo[h][YpicV],HouseInfo[h][ZpicV],false);
            
HouseInfo[h][PickupE] = CreatePickup(1559,23,HouseInfo[h][XpicE],HouseInfo[h][YpicE],HouseInfo[h][ZpicE],h);
            
hcount++;
            
printf("Äîì ¹%d çàãðóæåí.",h);
        }
        else 
ini_closeFile(iniFile);
    }
    return 
printf("\nÂñåãî çàãðóæåíî äîìîâ: %d",hcount);
}
stock HousePickup(playerid,pickupid// OnPlayerPickUpPickup(playerid,pickupid)
{
    for(new 
h=falseMAX_HOUSESh++)
    {
        new 
string[24];
        
format(string,sizeof(string),"House/%d.ini",h);
        new 
iniFile ini_openFile(string);
        if(
fexist(string))
        {
            
ini_getFloat(iniFile,"XnotV",HouseInfo[h][XspawnV]);
            
ini_getFloat(iniFile,"YnotV",HouseInfo[h][YspawnV]);
            
ini_getFloat(iniFile,"ZnotV",HouseInfo[h][ZspawnV]);
            
ini_getFloat(iniFile,"XnotE",HouseInfo[h][XspawnE]);
            
ini_getFloat(iniFile,"YnotE",HouseInfo[h][YspawnE]);
            
ini_getFloat(iniFile,"ZnotE",HouseInfo[h][ZspawnE]);
            
ini_getInteger(iniFile,"Interior",HouseInfo[h][Interior]);
            
ini_getString(iniFile,"Owner",HouseInfo[h][Owner]);
            
ini_closeFile(iniFile);
            if(
pickupid == HouseInfo[h][PickupV])
            {
                
SetPlayerInterior(playerid,HouseInfo[h][Interior]);
                
SetPlayerPos(playerid,HouseInfo[h][XspawnV],HouseInfo[h][YspawnV],HouseInfo[h][ZspawnV]);
                
SetPlayerVirtualWorld(playerid,h);
            }
            else if(
pickupid == HouseInfo[h][PickupE])
            {
                
SetPlayerInterior(playerid,false);
                
SetPlayerPos(playerid,HouseInfo[h][XspawnE],HouseInfo[h][YspawnE],HouseInfo[h][ZspawnE]);
                
SetPlayerVirtualWorld(playerid,false);
            }
        }
        else 
ini_closeFile(iniFile);
    }




Re: Помогите с домами! - Kai_Rodriges - 13.11.2013

PHP код:
if(!strcmp(HouseInfo[h][Owner],"HouseForSale"true))
{
    
//зеленая пикап
}
else
{
   
//Синий пикап




Re: Помогите с домами! - Nadim - 16.11.2013

Проблема решена!