how to show all money in your house....
#1

PHP код:
CMD:hwithdraw(playeridparams[])
{
    new 
string[128], option[32], amount;
    new 
idx PlayerInfo[playerid][pHouse];
       if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    if(!
PlayerInfo[playerid][pHouse] && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playeridCOLOR_GREY"You don't own a house.");
    if(
GetPlayerVirtualWorld(playerid)-500 != idx && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playeridCOLOR_GREY"You are not inside your house.");
    if(
GetPlayerVirtualWorld(playerid)-500 != idx && PlayerInfo[playerid][pVHouse])
    {
        
idx PlayerInfo[playerid][pVHouse];
        if(
GetPlayerVirtualWorld(playerid)-500 != idx) return SendClientMessage(playeridCOLOR_GREY"You are not inside your house.");
    }
    if(
sscanf(params"s[32]"option))
    {
        
SendClientMessage(playeridCOLOR_WHITE"[Usage]: /hsafe withdraw [item]");
        
SendClientMessage(playeridCOLOR_GREY"Items: 1) money | 2) weapon | 3) weed | 4) cocaine");
        
format(stringsizeof(string), "SAFE: $%d | %d Weed | %d cocaine"HouseInfo[idx][hMoney], HouseInfo[idx][hWeed], HouseInfo[idx][hcocaine]);
        
SendClientMessage(playeridCOLOR_WHITEstring);
        
format(stringsizeof(string), "SAFE: Weapon 1: %s (%d Ammo) | Weapon 2: %s (%d Ammo) | Weapon 3: %s (%d Ammo)"RWN(HouseInfo[idx][hGun][0]), HouseInfo[idx][hGunAmmo][0], RWN(HouseInfo[idx][hGun][1]), HouseInfo[idx][hGunAmmo][1], RWN(HouseInfo[idx][hGun][2]), HouseInfo[idx][hGunAmmo][2]);
        
SendClientMessage(playeridCOLOR_WHITEstring);
        
format(stringsizeof(string), "SAFE: Weapon 4: %s (%d Ammo) | Weapon 5: %s (%d Ammo)"RWN(HouseInfo[idx][hGun][3]), HouseInfo[idx][hGunAmmo][3], RWN(HouseInfo[idx][hGun][4]), HouseInfo[idx][hGunAmmo][4]);
        
SendClientMessage(playeridCOLOR_WHITEstring);
        return 
1;
    }
    if(!
strcmp(option"money"true5))
    {
        if(
sscanf(params"s[32]i"optionamount)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /hsafe withdraw money [amount]");
         if(
HouseInfo[idx][hMoney] < amount) return SendClientMessage(playeridCOLOR_GREY"You don't have that much money in your house vault.");
        
HouseInfo[idx][hMoney] -= amount;
         
GiveDodMoney(playeridamount);
         
format(stringsizeof(string), "* %s opens their vault, takes $%d and closes it."RPN(playerid), amount);
        
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
    }
    else if(!
strcmp(option"weapon"true4))
    {
         if(
sscanf(params"s[32]i"optionamount)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /hsafe withdraw weapon [slot]");
        if(
amount || amount 5) return SendClientMessage(playeridCOLOR_GREY"Weapon slots are between 1 and 5.");
        
amount amount-1;
        if(!
HouseInfo[idx][hGun][amount]) return SendClientMessage(playeridCOLOR_GREY"You don't have a weapon in this slot.");
        
GiveDodWeapon(playeridHouseInfo[idx][hGun][amount], HouseInfo[idx][hGunAmmo][amount]);
        
format(stringsizeof(string), "* %s opens their vault, takes a %s closes it."RPN(playerid), RWN(HouseInfo[idx][hGun][amount]));
        
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
         
HouseInfo[idx][hGun][amount] = 0;
        
HouseInfo[idx][hGunAmmo][amount] = 0;
    }
    else if(!
strcmp(option"weed"true4))
    {
           if(
sscanf(params"s[32]i"optionamount)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /hsafe withdraw weed [amount]");
        if(
HouseInfo[idx][hWeed] < amount) return SendClientMessage(playeridCOLOR_GREY"You don't have that much weed in your house vault.");
        
HouseInfo[idx][hWeed] -= amount;
        
PlayerInfo[playerid][pWeed] += amount;
        
format(stringsizeof(string), "* %s opens their vault, takes %d grams of weed and closes it."RPN(playerid), amount);
        
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
    }
    else if(!
strcmp(option"cocaine"true4))
    {
        if(
sscanf(params"s[32]i"optionamount)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /hsafe withdraw cocaine [amount]");
        if(
HouseInfo[idx][hcocaine] < amount) return SendClientMessage(playeridCOLOR_GREY"You don't have that much cocaine in your house vault.");
        
HouseInfo[idx][hcocaine] -= amount;
        
PlayerInfo[playerid][pcocaine] += amount;
            
format(stringsizeof(string), "* %s opens their vault, takes %d grams of cocaine and closes it."RPN(playerid), amount);
        
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
    }
    return 
1;

how to do when ppl write /hwithdraw to return
/hwithdraw money [you got ? Money]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)