Property Renting Help
#1

i have this /rentprop command this is for only 1 person only 1 person can rent that peroperty
but i want that /rentprop can rent 5 persons at a time
help me please
PHP код:
CMD:rentprop(playerid, params[])
{
    new 
playername[25], giveplayerid, giveplayer[25], tmp[1080], string[256], moneys1,strings[40];
    if (
areatype[playerarea[playerid]][0] != AREA_TYPE_PROP) return SendClientMessage2(playerid, COLOR_RED, "Error: You must be at a property to rent it!");
    
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
    
giveplayerid = dini_Int(AddDirFile(dir_userfiles, playername), "propowned");
    if (
giveplayerid != 0)
    {
        if (
areatype[playerarea[playerid]][1] == giveplayerid) return SendClientMessage2(playerid, COLOR_YELLOW, "You already own this property.");
    }
    
giveplayerid = dini_Int(AddDirFile(dir_userfiles, playername), "proprented");
    if (
giveplayerid != 0)
    {
        if (
areatype[playerarea[playerid]][1] == giveplayerid) SendClientMessage2(playerid, COLOR_YELLOW, "You are already an tenant in this property.");
        return 
1;
    }
    
format(giveplayer, 10, "prop%d", areatype[playerarea[playerid]][1]);
    
tmp = dini_Get(AddDirFile(dir_propfiles, giveplayer), "renter");
    if (
strcmp(tmp, "None", false) != 0) return SendPlayerFormattedText(playerid, COLOR_RED, "This property is already rented by %s and cannot be rented!", tmp, "");
    
moneys1 = dini_Int(AddDirFile(dir_propfiles, giveplayer), "rentcost");
    if(
moneys1 == 0) return SendClientMessage(playerid, COLOR_RED, "This property isnt set Let-To-Go.");
    if (
GetPlayerCash(playerid) < moneys1)
    {
        
format(string, 128, "You don't have $%d and cannot rent this property!", moneys1);
        
SendClientMessage2(playerid, COLOR_RED, string);
        return 
1;
    }
    if (
playerZone[playerid] > sizeof(zonenames)-11)
    {
            
format(strings,sizeof(strings),"%s.",zonenames[playerZone[playerid]][z_name]);
    }
    else
    {
            
format(strings,sizeof(strings),"%s, %s. ",zonenames[playerZone[playerid]][z_name], zonenames[sizeof(zonenames)-(zonetype[playerZone[playerid]]+1)][z_name]);
    }
    
GivePlayerCash(playerid, -moneys1);
    
dini_IntSet(AddDirFile(dir_userfiles, playername), "proprented", areatype[playerarea[playerid]][1]);
    
dini_Set(AddDirFile(dir_userfiles, playername), "HouseLocation", strings);
    
dini_Set(AddDirFile(dir_propfiles, giveplayer), "renter", playername);
    
dini_IntSet(AddDirFile(dir_propfiles, giveplayer), "rented", 1);
    
DestroyPickup(ppropids[areatype[playerarea[playerid]][1]]);
    
DestroyDynamicMapIcon(pmapicon[areatype[playerarea[playerid]][1]]);
    new 
Float:x, Float:y, Float:z;
    
x = dini_Float(AddDirFile(dir_propfiles, giveplayer), "X");
    
y = dini_Float(AddDirFile(dir_propfiles, giveplayer), "Y");
    
z = dini_Float(AddDirFile(dir_propfiles, giveplayer), "Z");
    
ppropids[areatype[playerarea[playerid]][1]] = CreatePickup(19523, 1, x, y, z, -1);
    
pmapicon[areatype[playerarea[playerid]][1]] = CreateDynamicMapIcon(x, y, z, 32, 0, -1, 0, -1, 600.0, MAPICON_LOCAL);
    
format(tmp, sizeof(tmp), "Owner: %s\nTenant: %s", dini_Get(AddDirFile(dir_propfiles, giveplayer), "owner"), RPN(playerid));
    
Update3DTextLabelText(ptextlabel[areatype[playerarea[playerid]][1]], 0xFF8533FF, tmp);
    for (new 
i = 0; i < PLAYERS; i++)
    {
        if (
IsPlayerInRangeOfPoint(i, 300.0, x, y, z)) Streamer_Update(i);
    }
    
format(string, 128, "You have rented this property for $%d. Welcome to your new home.", moneys1);
    
SendClientMessage2(playerid, COLOR_GREEN, string);
    
GameTextForPlayer(playerid, "~g~~h~~h~Property rented!", 5000, 3);
    return 
1;
} 
Reply
#2

bump
Reply
#3

anyone
Reply
#4

bump
Reply
#5

is their anybody who can help here please.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)