17.03.2016, 11:20
Hi guys, I have a problem with this script, pretty much when I go into the game and I / createbiz the server crashes but when I do it in duty says you're not allowed to use this command so how could I do? this is the cmd:
PHP код:
CMD:createbiz(playerid, params[])
{
new type, string[128];
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
// if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
if(sscanf(params, "i", type))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createbiz [type]");
SendClientMessage(playerid, COLOR_GREY, "TYPES: 1) 24/7 | 2) Clothes Shop | 3) Ammunation | 4) Club | 5) Advertisement Agency | 6) Fast Food | 7) Casino");
return 1;
}
if(type < 1 || type > 7) return SendClientMessage(playerid, COLOR_GREY, "Businesses are between 1 and 7.");
for(new idx=1; idx<MAX_BIZ; idx++)
{
if(!BizInfo[idx][bType])
{
//g_bizRobber[idx] = -1;
// Getting Business Setup
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
// Making Business
BizInfo[idx][bType] = type;
BizInfo[idx][bStatus] = 0;
format(BizInfo[idx][bOwner], 32, "The State");
BizInfo[idx][bX] = X;
BizInfo[idx][bY] = Y;
BizInfo[idx][bZ] = Z;
BizInfo[idx][bMoney] = 0;
BizInfo[idx][bProducts] = 0;
BizInfo[idx][bSold] = 0;
BizInfo[idx][bLevel] = 1;
BizInfo[idx][bPrice] = 500000;
BizInfo[idx][bPickup] = CreateDynamicPickup(1272, 1, X, Y, Z, 0);
format(string, sizeof(string), "[Business ID: %d]\nBusiness Type: %s\nBusiness Owner: %s\nStatus: For Sale\nPrice: $%d", idx, RBT(idx), BizInfo[idx][bOwner], BizInfo[idx][bPrice]);
BizInfo[idx][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, X, Y, Z, 15);
format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has created business ID %d.", RPN(playerid), idx);
//SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/business.log", string);
idx = MAX_BIZ;
}
}
return 1;
}