15.05.2013, 12:24
Hello community, could someone convert these commands to zcmd and highlight the places which you have changed so i would know?
pawn Код:
if(strcmp(cmd, "/bizfee", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new id = PlayerInfo[playerid][pPbiskey];
format( string, sizeof( string ), "Businesses/Business_%d.ini", id);
if(!dini_Exists(string))
{
SendClientMessage( playerid, COLOR_GREY, " You don't own a business !" );
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizfee [EntranceFee]");
}
if(BizzInfo[id][bType] > 0)
{
if(BizzInfo[id][bType] == 1) { businesstype = "24-7";}
else if(BizzInfo[id][bType] == 2) { businesstype = "Clothes Store";}
else if(BizzInfo[id][bType] == 3) { businesstype = "Club";}
else if(BizzInfo[id][bType] == 4) { businesstype = "Ammunation";}
else if(BizzInfo[id][bType] == 5) { businesstype = "Casino";}
else if(BizzInfo[id][bType] == 6) { businesstype = "Restaurant";}
else if(BizzInfo[id][bType] == 7) { businesstype = "Paintball";}
else if(BizzInfo[id][bType] == 8) { businesstype = "Bank";}
else if(BizzInfo[id][bType] == 9) { businesstype = "Electronic Store";}
else if(BizzInfo[id][bType] == 10) { businesstype = "Locks Store";}
else if(BizzInfo[id][bType] == 11) { businesstype = "Radio shop";}
}
else
{
businesstype = "Not Available";
}
if(strvalEx(tmp) < 0 || strvalEx(tmp) > 99999)
{
SendClientMessage(playerid, COLOR_WHITE, "Minimum entrance is $0, Maximum entrance is $99999.");
return 1;
}
format(string, sizeof(string), "{0000FF}[Business]{F0CC00}\nOwner: %s\n%s\nEntrance Fee: $%d\nID: %d", BizzInfo[id][bOwner], BizzInfo[id][bMessage],BizzInfo[id][bEntranceCost], id);
UpdateDynamic3DTextLabelText(business1[id], COLOR_DCHAT, string);
BizzInfo[id][bEntranceCost] = strvalEx(tmp);
format(string, sizeof(string), "Entrance fee set to $%d.", BizzInfo[id][bEntranceCost]);
SaveBusiness(id);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}
if(strcmp(cmd, "/extortion", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new id = PlayerInfo[playerid][pPbiskey];
format( string, sizeof( string ), "Businesses/Business_%d.ini", id);
if(!dini_Exists(string))
{
SendClientMessage( playerid, COLOR_GREY, " You don't own a Business!" );
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /extortion [PlayerID/PartOfName] (or 555 for Nobody)");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s is know Extortioning your Business.",giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has adjusted his Business, you are now Extortioning his Business.",sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s",giveplayer);
strmid(BizzInfo[id][bExtortion], string, 0, sizeof(string), 255);
format(string, sizeof(string), "Business Extortion Name set to %s",BizzInfo[id][bExtortion]);
SaveBusiness(id);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
else if(giveplayerid == 555)
{
format(string, sizeof(string), "Nobody");
strmid(BizzInfo[id][bExtortion], string, 0, sizeof(string), 255);
format(string, sizeof(string), "Business Extortion Name set to %s",BizzInfo[id][bExtortion]);
SaveBusiness(id);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Invalid ID!");
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/bizname", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new id = PlayerInfo[playerid][pPbiskey];
format( string, sizeof( string ), "Businesses/Business_%d.ini", id);
if(!dini_Exists(string))
{
SendClientMessage( playerid, COLOR_GREY, " You don't own a Business!" );
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizname [Name]");
}
if(BizzInfo[id][bType] > 0)
{
if(BizzInfo[id][bType] == 1) { businesstype = "24-7";}
else if(BizzInfo[id][bType] == 2) { businesstype = "Clothes Store";}
else if(BizzInfo[id][bType] == 3) { businesstype = "Club";}
else if(BizzInfo[id][bType] == 4) { businesstype = "Ammunation";}
else if(BizzInfo[id][bType] == 5) { businesstype = "Casino";}
else if(BizzInfo[id][bType] == 6) { businesstype = "Restaurant";}
else if(BizzInfo[id][bType] == 7) { businesstype = "Paintball";}
else if(BizzInfo[id][bType] == 8) { businesstype = "Bank";}
else if(BizzInfo[id][bType] == 9) { businesstype = "Electronic Store";}
else if(BizzInfo[id][bType] == 10) { businesstype = "Locks Store";}
else if(BizzInfo[id][bType] == 11) { businesstype = "Radio shop";}
}
else
{
businesstype = "Not Available";
}
format(string, sizeof(string), "{0000FF}[Business]{F0CC00}\nOwner: %s\n%s\nEntrance Fee: $%d\nID: %d", BizzInfo[id][bOwner], BizzInfo[id][bMessage],BizzInfo[id][bEntranceCost], id);
UpdateDynamic3DTextLabelText(business1[id], COLOR_DCHAT, string);
strmid(BizzInfo[id][bMessage], result, 0, 64, 255);
format(string, sizeof(string), "Business name set to %s",BizzInfo[id][bMessage]);
SaveBusiness(id);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}
if(strcmp(cmd, "/bizwithdraw", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new id = PlayerInfo[playerid][pPbiskey];
format( string, sizeof( string ), "Businesses/Business_%d.ini", id);
if(!dini_Exists(string))
{
SendClientMessage( playerid, COLOR_GREY, " You don't own a Business!" );
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
format(string, sizeof(string), " You have $%d in your Business Bank.", BizzInfo[id][bTill]);
SendClientMessage(playerid, COLOR_GRAD3, string);
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizwithdraw [amount]");
return 1;
}
new cashdeposit = strvalEx(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizwithdraw [amount]");
return 1;
}
if(cashdeposit > BizzInfo[id][bTill] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough money!");
return 1;
}
if(!IsPlayerInRangeOfPoint(playerid,100,BizzInfo[id][bExitX],BizzInfo[id][bExitY],BizzInfo[id][bExitZ]))
{
SendClientMessage(playerid, COLOR_GREY, " You are to far from your Business!");
return 1;
}
else
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+cashdeposit;
GivePlayerMoney(playerid,cashdeposit);
BizzInfo[id][bTill] -= cashdeposit;
format(string, sizeof(string), " You have withdrawn $%d from your Business Bank.", cashdeposit);
SaveBusiness(id);
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/sellbiz", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pPbiskey] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You don't own a Business!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellbiz [PlayerID/PartOfName] [price]");
return 1;
}
new money;
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellbiz [PlayerID/PartOfName] [price]");
return 1;
}
money = strvalEx(tmp);
if(money < 1) { SendClientMessage(playerid, COLOR_GREY, " Price can't be lower than $1!"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerInfo[giveplayerid][pPbiskey] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " This player already own a Business!");
return 1;
}
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, " You can't sell Business to yourself !"); return 1; }
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You offered to sell your Business to %s for $%d.", giveplayer, money);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s wants to sell his Business to you for $%d, (type /accept business) to accept.", sendername, money);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
BizID[giveplayerid] = PlayerInfo[playerid][pPbiskey];
BizOffer[giveplayerid] = playerid;
BizPrice[giveplayerid] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
}
}
return 1;
}
if(strcmp(cmd, "/bizdeposit", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new id = PlayerInfo[playerid][pPbiskey];
format( string, sizeof( string ), "Businesses/Business_%d.ini", id);
if(!dini_Exists(string))
{
SendClientMessage( playerid, COLOR_GREY, " You don't own a Business!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
format(string, sizeof(string), " You have $%d in your Business Bank.", BizzInfo[id][bTill]);
SendClientMessage(playerid, COLOR_GRAD3, string);
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizdeposit [Amount]");
return 1;
}
new cashdeposit = strvalEx(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizdeposit [amount]");
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if(cashdeposit > PlayerInfo[playerid][pCash] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't have enough money!");
return 1;
}
if(!IsPlayerInRangeOfPoint(playerid,100,BizzInfo[id][bExitX],BizzInfo[id][bExitY],BizzInfo[id][bExitZ]))
{
SendClientMessage(playerid, COLOR_GRAD2, " You are to far from your Business!");
return 1;
}
else
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-cashdeposit;
GivePlayerMoney(playerid,-cashdeposit);
BizzInfo[id][bTill] += cashdeposit;
ExtortionBiz(id, cashdeposit);
format(string, sizeof(string), " You have deposit $%d to your Business Bank.", cashdeposit);
SaveBusiness(id);
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
}
return 1;
}