problem with houses icons and time?
#2

try this

PHP код:

CMD
:buyh(playerid,params[])
{
    if(
PlayerInfo[playerid][LoggedIn] == 0) {
        
SendClientMessage(playeridCOLOR_BRIGHTRED"You must be logged in to use this command");
        return 
1;
    }
    new 
str[255],str1[255],pname[24], housenumber;
    
housenumber GetHouseID(playerid);
    if(
housenumber == -1) return SendClientMessage(playeridc_r"You are not in a house icon!");
    
GetPlayerName(playeridpname24);
    
format(str1sizeof(str1), "ladmin/users/%s.sav"udb_encode(pname));
    if(
dini_Exists(str1))
    {
        if (
dini_Int(str1"Houseid")!=-255) return SendClientMessage(playeridc_r"You can only buy one house!");
    }
    
format(str1sizeof(str1), "SATDM/Houses/houseid%d"housenumber);
    if (
strcmp(hInfo[housenumber][Name],DEFAULT_OWNER,true)) return SendClientMessage(playeridc_r"This house isn't for sale!");
    if(
GetPlayerMoney(playerid)<hInfo[housenumber][Cost]) return SendClientMessage(playeridc_r"Not enough money!");
    new 
hsstring[128];
    
format(hsstringsizeof(hsstring), "You just bought this House (ID:%i) for $%d."housenumberhInfo[housenumber][Cost]);
    
SendClientMessage(playeridCOLOR_GREENhsstring);
//    SendClientMessage(playerid, c_y, "You have bought the house!");
    
format(strsizeof(str), "%s has bought houseid %i",pname,housenumber);
    print(
str);
    
GivePlayerMoney(playerid, -hInfo[housenumber][Cost]);
    
dini_Set(str1"Name"pname);
    
hInfo[housenumber][Name]=pname;
    
hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",0);
    
format(str1sizeof(str1), "ladmin/users/%s.sav"udb_encode(pname));
    if (!
dini_Exists(str1)) dini_Create(str1);
    new 
Float:syFloat:sxFloat:sz;
    
dini_IntSet(str1"Houseid"housenumber);
    if(!
dini_Isset(str1,"Rentid"))
    {
        
dini_IntSet(str1"Rentid", -255);
    }
    
GetPlayerPos(playeridsx,sy,sz);
    
dini_FloatSet(str1"SpawnX"sx);
    
dini_FloatSet(str1"SpawnY"sy);
    
dini_FloatSet(str1"SpawnZ"sz);
    
dini_IntSet(str1"SpawnInt"GetPlayerInterior(playerid));
    
DestroyDynamicPickup(HousePickup[housenumber]);
    
HousePickup[housenumber] = CreateDynamicPickup(127223hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz]);
    new 
hnowner[30];
    
format(hnowner,128,"%s",hInfo[housenumber][Name]);
    if(
strcmp(hInfo[housenumber][Name],DEFAULT_OWNER,false) == 0) {
        
format(hnowner,128,"Not Owned");
    }
    
UpdateDynamic3DTextLabelText(hTextInfo[housenumber],0xFF0000FF,hnowner);
    
DestroyDynamicMapIcon(housemapicon[housenumber]);
    
housemapicon[housenumber] = CreateDynamicMapIcon(hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz],32,c_y);
    return 
1;

Reply


Messages In This Thread
problem with houses icons and time? - by vikoo - 29.09.2016, 17:19
Re: problem with houses icons and time? - by MCZOFT - 29.09.2016, 21:12
Re: problem with houses icons and time? - by vikoo - 29.09.2016, 22:55
Re: problem with houses icons and time? - by Tass007 - 30.09.2016, 00:06

Forum Jump:


Users browsing this thread: 1 Guest(s)