12.03.2017, 15:42
Good afternoon,
I have a little probem with the create businesses command, It's a long time ago that i was scripting.
But this is my problem,
If i use the command everything works, Till it creates, The pickup and the save is created but it doens't show up the textdraw and he doesn't see the ID from the businesses, So if you guys can help me
R.I.P english
I have a little probem with the create businesses command, It's a long time ago that i was scripting.
But this is my problem,
If i use the command everything works, Till it creates, The pickup and the save is created but it doens't show up the textdraw and he doesn't see the ID from the businesses, So if you guys can help me
PHP код:
command(createbusiness, playerid, params[])
{
new Usage[128], string[128];
if(sscanf(params, "z", Usage))
{
if(AdminLoggedIn[playerid] == 1 && Player[playerid][Adminlevel] >= 6)
{
SendClientMessage(playerid, WHITE, "SYNTAX: /createbusiness [usage]");
SendClientMessage(playerid, GREY, "Usage: Interior, Exterior, Shop or Complete.");
}else ErrorPTD(playerid,1,"You cannot use this command!");
}
else
{
if(AdminLoggedIn[playerid] == 1 && Player[playerid][Adminlevel] >= 6)
{
if(strcmp(Usage, "exterior", true) == 0)
{
Player[playerid][BizExterior]++;
Player[playerid][bExtID] = GetPlayerInterior(playerid);
GetPlayerFacingAngle(playerid, Player[playerid][bExtA]);
GetPlayerPos(playerid, Player[playerid][bExtX], Player[playerid][bExtY], Player[playerid][bExtZ]);
format(string, sizeof(string), "Exterior set! (X: %f, Y: %f, Z: %f).", Player[playerid][bExtX], Player[playerid][bExtY], Player[playerid][bExtZ]);
SendClientMessage(playerid, WHITE, string);
}
if(strcmp(Usage, "interior", true) == 0)
{
Player[playerid][BizInterior]++;
Player[playerid][bIntID] = GetPlayerInterior(playerid);
GetPlayerFacingAngle(playerid, Player[playerid][bIntA]);
GetPlayerPos(playerid, Player[playerid][bIntX], Player[playerid][bIntY], Player[playerid][bIntZ]);
format(string, sizeof(string), "Interior set! (X: %f, Y: %f, Z: %f).", Player[playerid][bIntX], Player[playerid][bIntY], Player[playerid][bIntZ]);
SendClientMessage(playerid, WHITE, string);
}
if(strcmp(Usage, "shop", true) == 0)
{
Player[playerid][BizShop]++;
Player[playerid][bShoID] = GetPlayerInterior(playerid);
GetPlayerPos(playerid, Player[playerid][bShoX], Player[playerid][bShoY], Player[playerid][bShoZ]);
format(string, sizeof(string), "Spawn possition set! (X: %f, Y: %f, Z: %f).", Player[playerid][bShoX], Player[playerid][bShoY], Player[playerid][bShoZ]);
SendClientMessage(playerid, WHITE, string);
}
if(strcmp(Usage, "complete", true) == 0)
{
if(Player[playerid][BizInterior] > 0 || Player[playerid][BizExterior] > 0)
{
new NewHouseID = SpawnedBusinesses+1;
if(NewHouseID >= MAX_BUSINESSES)
{
SendClientMessage(playerid, RED, "> Too many businesses are currently spawned!");
}
else
{
format(Businesses[NewHouseID][bName], 255, "None");
format(Businesses[NewHouseID][bOwner], 255, "Nobody");
format(Businesses[NewHouseID][bAddress], 255, "None");
Businesses[NewHouseID][bInteriorID] = Player[playerid][bIntID];
Businesses[NewHouseID][bExteriorID] = Player[playerid][bExtID];
Businesses[NewHouseID][bShopID] = Player[playerid][bShoID];
Businesses[NewHouseID][bInteriorX] = Player[playerid][bIntX];
Businesses[NewHouseID][bInteriorY] = Player[playerid][bIntY];
Businesses[NewHouseID][bInteriorZ] = Player[playerid][bIntZ];
Businesses[NewHouseID][bInteriorA] = Player[playerid][bIntA];
Businesses[NewHouseID][bExteriorX] = Player[playerid][bExtX];
Businesses[NewHouseID][bExteriorY] = Player[playerid][bExtY];
Businesses[NewHouseID][bExteriorZ] = Player[playerid][bExtZ];
Businesses[NewHouseID][bExteriorA] = Player[playerid][bExtA];
Businesses[NewHouseID][bShopX] = Player[playerid][bShoX];
Businesses[NewHouseID][bShopY] = Player[playerid][bShoY];
Businesses[NewHouseID][bShopZ] = Player[playerid][bShoZ];
Businesses[NewHouseID][bSupplies] = 1000;
Player[playerid][BizExterior]--;
Player[playerid][BizInterior]--;
Player[playerid][BizShop]--;
SendClientMessage(playerid, GREEN, "> Successfully created business, don't forget to /setbusiness!");
SetPlayerInterior(playerid, Businesses[NewHouseID][bExteriorID]);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerPos(playerid, Businesses[NewHouseID][bExteriorX], Businesses[NewHouseID][bExteriorY], Businesses[NewHouseID][bExteriorZ]);
Businesses[NewHouseID][bLockStatus] = 1;
Businesses[NewHouseID][bPickupID] = CreateDynamicPickup(1272, 23, Businesses[NewHouseID][bExteriorX], Businesses[NewHouseID][bExteriorY], Businesses[NewHouseID][bExteriorZ], 0);
new query[2000];
format(query, sizeof(query), "INSERT INTO `businesses` (`bInteriorID`, `bInteriorX`, `bInteriorY`, `bInteriorZ`, `bInteriorA`, `bExteriorID`, `bExteriorX`, `bExteriorY`, `bExteriorZ`, `bExteriorA`,");
format(query, sizeof(query), "%s `bShopID`, `bShopX`, `bShopY`, `bShopZ`, `bSupplies`) VALUES ", query);
format(query, sizeof(query), "%s(%d, '%f', '%f', '%f', '%f', %d, '%f', '%f', '%f', '%f', %d, '%f', '%f', '%f', %d)",
query,
Player[playerid][bIntID],
Player[playerid][bIntX],
Player[playerid][bIntY],
Player[playerid][bIntZ],
Player[playerid][bIntA],
Player[playerid][bExtID],
Player[playerid][bExtX],
Player[playerid][bExtY],
Player[playerid][bExtZ],
Player[playerid][bExtA],
Player[playerid][bShoID],
Player[playerid][bShoX],
Player[playerid][bShoY],
Player[playerid][bShoZ],
Businesses[NewHouseID][bSupplies]);
SpawnedBusinesses++;
mysql_query(query);
}
}
else
{
SendClientMessage(playerid, WHITE, "> You must select an exterior and an interior first!");
}
}
}else ErrorPTD(playerid,1,"You cannot use this command!");
}
return 1;
}