Command ZCMD help -
CaRa - 20.06.2013
Hi, i dunno how to convert this command from strcmp to zcmd & sscanf. Maybe other members who have necessary knowledge can help me. I tried to convert but unfortunately command doesn't work exactly like strcmp command. I give 1 RP to who can help me with this, thanks a lot.
Mention: This command is from Godfather mode.
Код:
if(strcmp(cmd, "/edit", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1338)
{
SendClientMessage(playerid, COLOR_GRAD2, "You are not an Admin !");
return 1;
}
new x_job[256];
x_job = strtok(cmdtext, idx);
if(!strlen(x_job)) {
SendClientMessage(playerid, COLOR_WHITE, "|__________________ Edit __________________|");
SendClientMessage(playerid, COLOR_WHITE, "{F97804}USAGE:{B4B5B7} /edit [name] [ammount] (Used for Houses and Businesses)");
SendClientMessage(playerid, COLOR_GREY, "Available names: Level, Price, Funds, Products");
SendClientMessage(playerid, COLOR_WHITE, "|____________________________________________|");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{F97804}USAGE:{B4B5B7} /edit [name] [ammount]");
return 1;
}
new proplev = strval(tmp);
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if (PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
{
format(string, sizeof(string), "House: %d", i);
SendClientMessage(playerid, COLOR_GRAD2, string);
if(proplev > 0)
{
if(strcmp(x_job,"level",true) == 0)
{
HouseInfo[i][hLevel] = proplev;
OnPropTextdrawUpdate(1, i);
}
else if(strcmp(x_job,"price",true) == 0)
{
HouseInfo[i][hValue] = proplev;
OnPropTextdrawUpdate(1, i);
}
}
}
}
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
{
format(string, sizeof(string), "Biz: %d", i);
SendClientMessage(playerid, COLOR_GRAD2, string);
if(proplev > 0)
{
if(strcmp(x_job,"level",true) == 0)
{
BizzInfo[i][bLevelNeeded] = proplev;
}
else if(strcmp(x_job,"price",true) == 0)
{
BizzInfo[i][bBuyPrice] = proplev;
}
else if(strcmp(x_job,"funds",true) == 0)
{
BizzInfo[i][bTill] = proplev;
}
else if(strcmp(x_job,"products",true) == 0)
{
BizzInfo[i][bProducts] = proplev;
}
}
}
}
format(string, sizeof(string), "You've adjusted the: %s.", x_job);
SendClientMessage(playerid, COLOR_WHITE, string);
OnPropUpdate();
}
return 1;
}
Re: Command ZCMD help -
BpVanshVk - 20.06.2013
Код:
CMD:edit(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1338)
{
SendClientMessage(playerid, COLOR_GRAD2, "You are not an Admin !");
return 1;
}
}
new x_job[256];
x_job = strtok(cmdtext, idx);
if(!strlen(x_job)) {
SendClientMessage(playerid, COLOR_WHITE, "|__________________ Edit __________________|");
SendClientMessage(playerid, COLOR_WHITE, "{F97804}USAGE:{B4B5B7} /edit [name] [ammount] (Used for Houses and Businesses)");
SendClientMessage(playerid, COLOR_GREY, "Available names: Level, Price, Funds, Products");
SendClientMessage(playerid, COLOR_WHITE, "|____________________________________________|");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{F97804}USAGE:{B4B5B7} /edit [name] [ammount]");
return 1;
}
new proplev = strval(tmp);
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if (PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
{
format(string, sizeof(string), "House: %d", i);
SendClientMessage(playerid, COLOR_GRAD2, string);
if(proplev > 0)
{
if(strcmp(x_job,"level",true) == 0)
{
HouseInfo[i][hLevel] = proplev;
OnPropTextdrawUpdate(1, i);
}
else if(strcmp(x_job,"price",true) == 0)
{
HouseInfo[i][hValue] = proplev;
OnPropTextdrawUpdate(1, i);
}
}
}
}
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
{
format(string, sizeof(string), "Biz: %d", i);
SendClientMessage(playerid, COLOR_GRAD2, string);
if(proplev > 0)
{
if(strcmp(x_job,"level",true) == 0)
{
BizzInfo[i][bLevelNeeded] = proplev;
}
else if(strcmp(x_job,"price",true) == 0)
{
BizzInfo[i][bBuyPrice] = proplev;
}
else if(strcmp(x_job,"funds",true) == 0)
{
BizzInfo[i][bTill] = proplev;
}
else if(strcmp(x_job,"products",true) == 0)
{
BizzInfo[i][bProducts] = proplev;
}
}
}
}
format(string, sizeof(string), "You've adjusted the: %s.", x_job);
SendClientMessage(playerid, COLOR_WHITE, string);
OnPropUpdate();
}
return 1;
}
+REP would be Appreciated if it helps.
Re: Command ZCMD help -
CaRa - 20.06.2013
Thanks.
Re: Command ZCMD help -
BpVanshVk - 20.06.2013
Quote:
Originally Posted by CaRa
Thanks.
|
No problem.