Defining an item? -
RLGaming - 12.10.2012
pawn Код:
CMD:hpurchase(playerid, params[])
{
new item[32], string[128];
if(PlayerInfo[playerid][pVip] >= 3)
{
if(PlayerInfo[playerid][pPhousekey] > -1 || PlayerInfo[playerid][pPhousekey2] > -1)
{
if(sscanf(params, "s[32]", item)) return SendClientMessage(playerid, COLOR_WHITE, "USAGR: /hpurchase [item] (/hitemhelp)");
if(arrHousing[playerid][fExist] == 1)
{
format(string, sizeof(string), "You have just purchased a %s!", item);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SaveUser(playerid);
}
else SendClientMessage(playerid, COLOR_WHITE, "That item does not exist!");
}
else SendClientMessage(playerid, COLOR_WHITE, "You need to own a house to use this feature!");
}
else SendClientMessage(playerid, COLOR_WHITE, "You need to be a Gold VIP to use this feature!");
return 1;
}
So I have that CMD, but where can I like define somewhere like fExist 1 means they purchased a chair and fexist 2 means they purchased a bed, how can I do this?
Re: Defining an item? -
Kwarde - 13.10.2012
This is possible. Somewhere, near the defined color's you can do this:
pawn Код:
// Colors are here, like #define COLOR_WHITE 0xFFFFFFAA
#define ITEM_CHAIR 1
#define ITEM_BED 2
#define ITEM_PILLOW 3 //Example
Then, instead of using 'fExist == 1' or 'fExist == 2', you can use 'fExist == ITEM_CHAIR' or 'fExist == ITEM_BED'.
Re: Defining an item? -
RLGaming - 13.10.2012
Thank you!! This works!
But would it work this way to save me inputting all the fExist == id?
pawn Код:
new WeaponNames[47][] =
{
"Unarmed","BrassKnuckles","Golfclub","Nitestick","Knife","Baseball Bat","Shovel","Poolcue","Katana","Chainsaw","Purple Dildo","Small White Vibrator","Large White Vibrator","Silver Vibrator",
"Flowers","Cane","Grenade","Tear Gas Grenade","Molotov Cocktail","Jetpack"," "," ","9mm","Silenced 9mm","Deagle","Shotgun","Sawn-Off Shotgun","SPAS-12",
"MicroUzi","MP5","AK-47","M4","Tec-9","Rifle","Sniper Rifle","RPG","Heatseeker","Flamethrower","Minigun","SatchelCharge","Detonator","SprayCan","Fire Extinguisher",
"Camera","Nightvision Goggles", "Thermal Goggles","Parachute"
};
Just an example, if I used that to define the items as it goes up from like 1 to whatever i think
Re: Defining an item? -
gtakillerIV - 13.10.2012
Fexist = For file use only!
Fexist = File exist, it checks if the file exists. Ex:
PHP код:
if(!fexist("myfile.txt"))
{
print("Your file does not exist");
}
Re: Defining an item? -
RLGaming - 13.10.2012
Lol..
I know, im using it in an enum, it works fine.