CMD:addhouse(playerid, params[])
{
new price2;
if(sscanf(params, "d", price2))
return SendClientMessage(playerid, 0xFFFFFFAA, "Use: /addhouse [price]");
if(price2 < 10)
return SendClientMessage(playerid, 0xFF0000FF,"Error: Price must be higher than 10"); //change this price if you want..
// if(sell2 < 10) //i forgot they are just normal numbers. Strval is only used if you have a string, and you want to know it's value xd k wait a sec
// return SendClientMessage(playerid, 0xFF0000FF,"Error: Sell value must be higher than 10"); //change this value if you want..
static PropertyCount;
PropertyCount += 1;
if(!IsPlayerAdmin(playerid))
return 0;
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
//AddProperty(X,Y,Z, price2); //this calls a function that creates the pickup and assigns the variables.
HouseInfo[PropertyCount][HouseExists] = 1;
HouseInfo[PropertyCount][HouseX] = X;
HouseInfo[PropertyCount][HouseY] = Y;
HouseInfo[PropertyCount][HouseZ] = Z;
HouseInfo[PropertyCount][HouseValue] = price2;
HouseInfo[PropertyCount][HouseOwner] = -1;
HouseInfo[houseid][HouseIsBought] = 0;
PropertyPickup[PropertyCount] = CreatePickup(1272, 1, X, Y, Z);
new entry[128], entry2[128];
new File:hFile;
format(entry, 128, "AddProperty(%.2f, %.2f, %.2f, %d);", X, Y, Z, price2); //it only add's it to a file, and this has to be read.
format(entry2, 128, "\r\n%s",entry);
hFile = fopen("SavedProperties.txt", io_append);
fwrite(hFile, entry2);
fclose(hFile);
return 1;
}
You need to create a 3d text draw above the pickup with the info you want, then the info would be shown. Just creating a pickup won't show any text.
|
//OnPlayerPickUpPickUp
new houseid = -1;
new IDD = IsPlayerNearHouse(playerid);
for(new idd; idd<MAX_HOUSES; idd++)
{
if(HouseInfo[idd][HousePickup])
{
houseid = idd;
break;
}
}
if(houseid != -1)
{
new str[128];
format(str, 128, "~y~Price: ~w~$%d~n~~y~Owner: ~w~%s~n~~y~House ID: ~w~%d", HouseInfo[houseid][HouseValue], HouseInfo[houseid][HouseOwner], IDD);
GameTextForPlayer(playerid, str, 6000, 3);
new ownerid = GetPlayerID(HouseInfo[IDD][HouseOwner]);
if(ownerid == playerid)
{
SetPlayerHealth(ownerid,100.0);
SetPlayerArmour(ownerid,100.0);
}
}
PropertyPickup[PropertyCount] = CreatePickup(1272, 1, X, Y, Z);
HouseInfo[idd][HousePickup] = CreatePickup(1272, 1, X, Y, Z);
So I think you can retrieve the ID of it from the database in scriptfiles, easy! ( follow @ShihabSoft first, if it didn't work do what i told you )
|