public PickupMessages(playerid)
{
new string[512];
for(new h = 1; h < MAX_HOUSES; h++)
{
if(IsPlayerInAnyVehicle(playerid)) return 1;
if(IsPlayerInRangeOfPoint(playerid, 2.0, Houses[h][HouseExteriorX], Houses[h][HouseExteriorY], Houses[h][HouseExteriorZ]))
{
if(GetPlayerVirtualWorld(playerid) == 0)
{
if(strmatch(Houses[h][HouseOwner], "Nobody"))
{
if(Player[playerid][AdminLevel] == 10)
{
format(string, sizeof(string), "~w~House %d~n~~b~%s~n~~w~Use ~b~/buyhouse~w~ to~n~buy this house~n~for ~g~$%d.", h, Houses[h][HouseName], Houses[h][HousePrice]);
}
else
{
format(string, sizeof(string), "~b~%s~n~~w~Use ~b~/buyhouse~w~ to~n~buy this house~n~for ~g~$%d.", Houses[h][HouseName], Houses[h][HousePrice]);
}
}
else
{
if(Player[playerid][AdminLevel] == 10)
{
format(string, sizeof(string), "~w~House %d~n~~b~%s~n~~w~Owner:~g~ %s", h, Houses[h][HouseName], Houses[h][HouseOwner]);
}
else
{
format(string, sizeof(string), "~b~%s~n~~w~Owner:~g~ %s", Houses[h][HouseName], Houses[h][HouseOwner]);
}
}
}
}
}
for(new b = 1; b < MAX_BUSINESS; b++)
{
if(IsPlayerInAnyVehicle(playerid)) return 1;
if(IsPlayerInRangeOfPoint(playerid, 2.0, Business[b][BusinessExteriorX], Business[b][BusinessExteriorY], Business[b][BusinessExteriorZ]))
{
if(GetPlayerVirtualWorld(playerid) == 0)
{
if(Player[playerid][AdminLevel] == 10)
{
format(string, sizeof(string), "~w~Business %d~n~~b~%s~n~~w~~n~Owner:~g~ %s~n~~w~Enter Fee: ~g~$%d~n~~w~~n~Type /enter to go inside", b, Business[b][BusinessName], Business[b][BusinessOwner], Business[b][BusinessEnterFee]);
}
else
{
format(string, sizeof(string), "~w~Business~n~~b~%s~n~~w~~n~Owner:~g~ %s~n~~w~Enter Fee: ~g~$%d~n~~w~~n~Type /enter to go inside", Business[b][BusinessName], Business[b][BusinessOwner], Business[b][BusinessEnterFee]);
}
}
}
}
GameTextForPlayer(playerid, string, 3000, 5);
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 2.0, Business[b][BusinessExteriorX], Business[b][BusinessExteriorY], Business[b][BusinessExteriorZ]))
How could I do that? Like, create a /gotobusiness command with the business ID in sscanf?
Then, check if it's letting me go to it? :3 |
COMMAND:tp(playerid, params[])
{
new idx = strval(params);
if( idx > -1 && idx < sizeof(Business) )
{
SetPlayerPos(playerid, Business[idx][BusinessExteriorX], Business[idx][BusinessExteriorY], Business[idx][BusinessExteriorZ]);
}
return 1;
}
stock LoadBusinesses()
{
new
Str[128],
string[512],
bID,
bName[128],
bOwner[24],
Float:ExtX,
Float:ExtY,
Float:ExtZ,
Float:IntX,
Float:IntY,
Float:IntZ,
Price,
Enterable,
IntID,
Fee,
PayOut,
Locked,
World;
mysql_query("SELECT * FROM `Businesses`");
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(Str))
{
sscanf(Str, "p<|>is[128]s[24]ffffffiiiiiii", bID, bName, bOwner, ExtX, ExtY, ExtZ, IntX, IntY, IntZ, IntID, Price, Enterable, Fee, PayOut, Locked, World);
BusinessPickup[bID] = CreatePickup(1272, 1, ExtX, ExtY, ExtZ, 0);
new i = 1;
Business[i][BusinessExteriorX] = ExtX;
Business[i][BusinessExteriorY] = ExtY;
Business[i][BusinessExteriorZ] = ExtZ;
Business[i][BusinessInteriorX] = IntX;
Business[i][BusinessInteriorY] = IntY;
Business[i][BusinessInteriorZ] = IntZ;
Business[i][BusinessInteriorID] = IntID;
Business[i][BusinessPrice] = Price;
Business[i][BusinessEnterable] = Enterable;
Business[i][BusinessEnterFee] = Fee;
Business[i][BusinessPayout] = PayOut;
Business[i][BusinessLocked] = Locked;
Business[i][BusinessWorld] = World;
format(Business[i][BusinessName], 128, "%s", bName);
format(Business[i][BusinessOwner], 24, "%s", bOwner);
if(Enterable == 0)
{
format(string, sizeof(string), "{FF0000}%s\nOwner:{FFFFFF}%s\n{FF0000}Payout: {FFFFFF}$%d", bName, bOwner, PayOut);
}
else
{
format(string, sizeof(string), "{33FF33}%s\nEntrance Fee: {FFFFFF}$%d{33FF33}\nOwner: {FFFFFF}%s\n{33FF33}Payout: {FFFFFF}$%d", bName, Fee, bOwner,PayOut);
}
BusinessLabel[i] = Create3DTextLabel(string, BLUE, ExtX, ExtY, ExtZ, 7.0, 0, 1);
i++;
bTotal++;
}
}
mysql_free_result();
printf("%i businesses loaded from the MySQL Database.", bTotal);
}
new i = 1;