24.09.2012, 11:56
Hello guys now i need a bit help i gonna change strcmp to zcmd so is there any tutorial how to do it? thanks in advance.
CMD:"yourcmdhere"(playerid,params[])
{
GivePlayerWeapon(playerid, 24, 500);
GivePlayerWeapon(playerid, 26, 500);
GivePlayerWeapon(playerid, 28, 500); //this is an example , its just basically changing the beggining of it)
return 1;
}
}
//===============================[Bizz system]=================================================
if(strcmp(cmd,"/bizz",true)==0)
{
if(IsPlayerConnected(playerid))
{
new x_nr[128];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_GREEN, "HINT: /bizz [info/name/fee/extortion/withdraw/bank/open/lock/sell/buy]");
return 1;
}
if(strcmp(x_nr,"name",true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey];
if (bouse == 255)
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't own a business");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
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: /bizz name [Name]");
return 1;
}
if(strlen(result) >= 20)
{
SendClientMessage(playerid, COLOR_WHITE, "Name is too long.");
return 1;
}
if (bouse >= 100)
{
strmid(SBizzInfo[bouse-100][sbMessage], result, 0, 64, 255);
format(string, sizeof(string), "Business name set to %s",SBizzInfo[bouse-100][sbMessage]);
}
else
{
strmid(BizzInfo[bouse][bMessage], result, 0, 64, 255);
format(string, sizeof(string), "Business name set to %s",BizzInfo[bouse][bMessage]);
}
OnPropUpdate();
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(strcmp(x_nr,"fee",true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey];
if (bouse == 255)
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't own a business !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizz fee [EntranceFee]");
}
if(strval(tmp) < 0 || strval(tmp) > 50)
{
SendClientMessage(playerid, COLOR_WHITE, "Minimum entrance is $0, Maximum entrance is $50.");
return 1;
}
if (bouse >= 100)
{
SBizzInfo[bouse-100][sbEntranceCost] = strval(tmp);
format(string, sizeof(string), "Entrance fee set to $%d.", SBizzInfo[bouse-100][sbEntranceCost]);
}
else
{
BizzInfo[bouse][bEntranceCost] = strval(tmp);
format(string, sizeof(string), "Entrance fee set to $%d.", BizzInfo[bouse][bEntranceCost]);
}
OnPropUpdate();
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(strcmp(x_nr,"extortion",true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey];
if (bouse == 255)
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't own a business");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizz extortion [playerid] (or 555 for No-one)");
return 1;
}
giveplayerid = strval(tmp);
if(giveplayerid == 555)
{
if (bouse >= 100)
{
format(string, sizeof(string), "No-one");
strmid(SBizzInfo[bouse-100][sbExtortion], string, 0, sizeof(string), 255);
format(string, sizeof(string), "Business Extortion Name set to %s",SBizzInfo[bouse-100][sbExtortion]);
}
else
{
format(string, sizeof(string), "No-one");
strmid(BizzInfo[bouse][bExtortion], string, 0, sizeof(string), 255);
format(string, sizeof(string), "Business Extortion Name set to %s",BizzInfo[bouse][bExtortion]);
}
OnPropUpdate();
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(IsPlayerConnected(giveplayerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s is know Extortioning your Business.",giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* %s has adjusted there Business, you are now Extortioning at there Business.",sendername);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
if (bouse >= 100)
{
format(string, sizeof(string), "%s",giveplayer);
strmid(SBizzInfo[bouse-100][sbExtortion], string, 0, sizeof(string), 255);
format(string, sizeof(string), "Business Extortion Name set to %s",SBizzInfo[bouse-100][sbExtortion]);
}
else
{
format(string, sizeof(string), "%s",giveplayer);
strmid(BizzInfo[bouse][bExtortion], string, 0, sizeof(string), 255);
format(string, sizeof(string), "Business Extortion Name set to %s",BizzInfo[bouse][bExtortion]);
}
OnPropUpdate();
SendClientMessage(playerid, COLOR_WHITE, string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
else if(strcmp(x_nr,"withdraw",true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey];
if (bouse == 255)
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't own a business");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
if (bouse >= 100)
{
format(string, sizeof(string), " You Have $%d in your till.", SBizzInfo[bouse-100][sbTill]);
SendClientMessage(playerid, COLOR_GRAD3, string);
}
else
{
format(string, sizeof(string), " You Have $%d in your till.", BizzInfo[bouse][bTill]);
SendClientMessage(playerid, COLOR_GRAD3, string);
}
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /bizz withdraw [amount]");
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /bizz withdraw [amount]");
return 1;
}
if (bouse >= 100)
{
if(cashdeposit > SBizzInfo[bouse-100][sbTill] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " You dont have that much");
return 1;
}
}
else
{
if (cashdeposit > BizzInfo[bouse][bTill] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " You dont have that much");
return 1;
}
}
if (bouse >= 100)
{
if(!PlayerToPoint(100, playerid,SBizzInfo[bouse-100][sbEntranceX],SBizzInfo[bouse-100][sbEntranceY],SBizzInfo[bouse-100][sbEntranceZ]))
{
SendClientMessage(playerid, COLOR_GRAD2, " You are to far from your business");
return 1;
}
else
{
//ConsumingMoney[playerid] = 1;
GivePlayerPCash(playerid,cashdeposit);
SBizzInfo[bouse-100][sbTill] -= cashdeposit;
format(string, sizeof(string), " You Have Withdrawn $%d from your till Total: $%d ", cashdeposit,SBizzInfo[bouse-100][sbTill]);
OnPropUpdate();
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
}
else
{
if (!PlayerToPoint(100, playerid,BizzInfo[bouse][bExitX],BizzInfo[bouse][bExitY],BizzInfo[bouse][bExitZ]))
{
SendClientMessage(playerid, COLOR_GRAD2, " You are to far from your business");
return 1;
}
else
{
//ConsumingMoney[playerid] = 1;
GivePlayerPCash(playerid,cashdeposit);
BizzInfo[bouse][bTill] -= cashdeposit;
format(string, sizeof(string), " You Have Withdrawn $%d from your till Total: $%d ", cashdeposit,BizzInfo[bouse][bTill]);
OnPropUpdate();
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
}
}
else if(strcmp(x_nr,"bank",true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey];
if (bouse == 255)
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't own a business");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
if (bouse >= 100)
{
format(string, sizeof(string), " You Have $%d in your till.", SBizzInfo[bouse-100][sbTill]);
SendClientMessage(playerid, COLOR_GRAD3, string);
}
else
{
format(string, sizeof(string), " You Have $%d in your till.", BizzInfo[bouse][bTill]);
SendClientMessage(playerid, COLOR_GRAD3, string);
}
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /bizz bank [amount]");
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /bizz bank [amount]");
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if (cashdeposit > GetPlayerPCash(playerid) || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " You dont have that much");
return 1;
}
if (bouse >= 100)
{
if(!PlayerToPoint(100, playerid,SBizzInfo[bouse-100][sbEntranceX],SBizzInfo[bouse-100][sbEntranceY],SBizzInfo[bouse-100][sbEntranceZ]))
{
SendClientMessage(playerid, COLOR_GRAD2, " You are to far from your business");
return 1;
}
else
{
GivePlayerPCash(playerid,-cashdeposit);
SBizzInfo[bouse-100][sbTill] += cashdeposit;
ExtortionSBiz(bouse-100, cashdeposit);
format(string, sizeof(string), " You Have Banked $%d to your till Total: $%d ", cashdeposit,SBizzInfo[bouse-100][sbTill]);
OnPropUpdate();
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
}
else
{
if (!PlayerToPoint(100, playerid,BizzInfo[bouse][bExitX],BizzInfo[bouse][bExitY],BizzInfo[bouse][bExitZ]))
{
SendClientMessage(playerid, COLOR_GRAD2, " You are to far from your business");
return 1;
}
else
{
GivePlayerPCash(playerid,-cashdeposit);
BizzInfo[bouse][bTill] += cashdeposit;
ExtortionBiz(bouse, cashdeposit);
format(string, sizeof(string), " You Have Banked $%d to your till Total: $%d ", cashdeposit,BizzInfo[bouse][bTill]);
OnPropUpdate();
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
}
}
else if(strcmp(x_nr,"open",true) == 0)
{
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]) || PlayerToPoint(3, playerid,BizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]))
{
if(PlayerInfo[playerid][pPbiskey] == i)
{
if(BizzInfo[i][bLocked] == 1)
{
BizzInfo[i][bLocked] = 0;
SendClientMessage(playerid,COLOR_LIGHTRED,"Door unlocked");
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
else
{
GameTextForPlayer(playerid, "~r~You Dont Have A Key", 5000, 6);
return 1;
}
}
}
}
else if(strcmp(x_nr,"lock",true) == 0)
{
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]) || PlayerToPoint(3, playerid,BizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]))
{
if(PlayerInfo[playerid][pPbiskey] == i)
{
if(BizzInfo[i][bLocked] == 0)
{
BizzInfo[i][bLocked] = 1;
SendClientMessage(playerid,COLOR_LIGHTRED,"Door locked");
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
else
{
GameTextForPlayer(playerid, "~r~You Dont Have A Key", 5000, 6);
return 1;
}
}
}
}
else if(strcmp(x_nr,"buy",true) == 0)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
if(PlayerInfo[playerid][pPbiskey] != 255)
{
SendClientMessage(playerid, COLOR_WHITE, " You already own a business, type /bizz sell if you want to buy this one.");
return 1;
}
for(new b = 0; b < sizeof(SBizzInfo); b++)
{
if(PlayerToPoint(2.0, playerid, SBizzInfo[b][sbEntranceX], SBizzInfo[b][sbEntranceY], SBizzInfo[b][sbEntranceZ]) && SBizzInfo[b][sbOwned] == 0)
{
if(PlayerInfo[playerid][pLevel] < SBizzInfo[b][sbLevelNeeded])
{
format(string, sizeof(string), "You Must Be Level %d To Purchase This",SBizzInfo[b][sbLevelNeeded]);
SendClientMessage(playerid, COLOR_GRAD5, string);
return 1;
}
if(GetPlayerPCash(playerid) >= SBizzInfo[b][sbBuyPrice])
{
PlayerInfo[playerid][pPbiskey] = b+100;
SBizzInfo[b][sbOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(SBizzInfo[b][sbOwner], sendername, 0, strlen(sendername), 255);
GivePlayerPCash(playerid,-SBizzInfo[b][sbBuyPrice]);
DestroyPickup(SBizzInfo[b][sbPickupID]);
SBizzInfo[b][sbPickupID]=CreatePickup(1239, 1, SBizzInfo[b][sbEntranceX], SBizzInfo[b][sbEntranceY], SBizzInfo[b][sbEntranceZ]);
SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On your New Purchase.");
SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");
OnPropUpdate();
HouseEntered[playerid] = b;
OnPlayerDataSave(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
return 1;
}
}
}
for(new b = 0; b < sizeof(BizzInfo); b++)
{
if(PlayerToPoint(2.0, playerid, BizzInfo[b][bEntranceX], BizzInfo[b][bEntranceY], BizzInfo[b][bEntranceZ]) && BizzInfo[b][bOwned] == 0)
{
if(PlayerInfo[playerid][pLevel] < BizzInfo[b][bLevelNeeded])
{
format(string, sizeof(string), "You Must Be Level %d To Purchase This",BizzInfo[b][bLevelNeeded]);
SendClientMessage(playerid, COLOR_GRAD5, string);
return 1;
}
if(GetPlayerPCash(playerid) >= BizzInfo[b][bBuyPrice])
{
PlayerInfo[playerid][pPbiskey] = b;
BizzInfo[b][bOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(BizzInfo[b][bOwner], sendername, 0, strlen(sendername), 255);
GivePlayerPCash(playerid,-BizzInfo[b][bBuyPrice]);
//PlayerPlayMusic(playerid);
SetPlayerInterior(playerid,BizzInfo[b][bInterior]);
PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior];
DestroyPickup(BizzInfo[b][bPickupID]);
BizzInfo[b][bPickupID]=CreatePickup(1239, 1, BizzInfo[b][bEntranceX], BizzInfo[b][bEntranceY], BizzInfo[b][bEntranceZ]);
DOO_SetPlayerPos(playerid,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
GameTextForPlayer(playerid, "~w~Welcome~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior];
PlayerInfo[playerid][pLocal] = b ;
SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On your New Purchase.");
SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");
OnPropUpdate();
HouseEntered[playerid] = b;
OnPlayerDataSave(playerid);
SetPlayerVirtualWorld(playerid,b);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
return 1;
}
}
}
}
else if(strcmp(x_nr,"sell",true) == 0)
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pPbiskey] == 255)
{
SendClientMessage(playerid, COLOR_WHITE, "You don't own a bizz.");
return 1;
}
if(PlayerInfo[playerid][pPbiskey] >= 100 && strcmp(playername, SBizzInfo[PlayerInfo[playerid][pPbiskey]-100][sbOwner], true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey]-100;
GivePlayerPCash(playerid,SBizzInfo[bouse][sbTill]);
SBizzInfo[bouse][sbLocked] = 1;
SBizzInfo[bouse][sbOwned] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(SBizzInfo[bouse][sbOwner], "The State", 0, strlen("The State"), 255);
strmid(SBizzInfo[bouse][sbExtortion], "No-one", 0, strlen("No-one"), 255);
//ConsumingMoney[playerid] = 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d", SBizzInfo[bouse][sbBuyPrice]);
GameTextForPlayer(playerid, string, 10000, 3);
DestroyPickup(SBizzInfo[bouse][sbPickupID]);
SBizzInfo[bouse][sbPickupID]=CreatePickup(1272, 1, SBizzInfo[bouse][sbEntranceX], SBizzInfo[bouse][sbEntranceY], SBizzInfo[bouse][sbEntranceZ]);
SBizzInfo[bouse][sbTill] = 0;
PlayerInfo[playerid][pPbiskey] = 255;
OnPropUpdate();
GivePlayerPCash(playerid,SBizzInfo[bouse][sbBuyPrice]);
return 1;
}
if(strcmp(playername, BizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey];
BizzInfo[bouse][bLocked] = 1;
BizzInfo[bouse][bOwned] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(BizzInfo[bouse][bOwner], "The State", 0, strlen("The State"), 255);
strmid(BizzInfo[bouse][bExtortion], "No-one", 0, strlen("No-one"), 255);
//ConsumingMoney[playerid] = 1;
GivePlayerPCash(playerid,BizzInfo[bouse][bTill]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d", BizzInfo[bouse][bBuyPrice]);
GameTextForPlayer(playerid, string, 10000, 3);
DestroyPickup(BizzInfo[bouse][bPickupID]);
BizzInfo[bouse][bPickupID]=CreatePickup(1272, 1, BizzInfo[bouse][bEntranceX], BizzInfo[bouse][bEntranceY], BizzInfo[bouse][bEntranceZ]);
BizzInfo[bouse][bTill] = 0;
PlayerInfo[playerid][pPbiskey] = 255;
OnPropUpdate();
GivePlayerPCash(playerid,BizzInfo[bouse][bBuyPrice]);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't own a business.");
return 1;
}
}
else if(strcmp(x_nr,"info",true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey];
if(bouse == 255)
{
SendClientMessage(playerid, COLOR_WHITE, "You don't own a business.");
return 1;
}
if (bouse >= 100)
{
PrintSBizInfo(playerid,bouse-100);
}
else
{
PrintBizInfo(playerid,bouse);
return 1;
}
}
else { return 1; }
}
return 1;
What about this?
pawn Код:
|
}
CMD:me(playerid, params[])
{
new text[128],string[128],sendername[MAX_PLAYER_NAME];
if(sscanf(params, "s[128]", text)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /me [text]");
else
{
if(Mute[playerid] == 1) return SendClientMessage(playerid,COLOR_LIGHTRED,"WARNING: You are currently muted.");
format(sendername, sizeof(sendername), "%s", PlayerName(playerid));
GiveNameSpace(sendername);
format(string, sizeof(string), "* %s %s", sendername, text);
ProxDetector(30.0, playerid, string, COLOR_PURPLE);
}
return 1;
CMD:me(playerid, params[])
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name));
strreplace(name,'_',' ');
if(sscanf(params,"s[128]",str)) return SendClientMessage(playerid,COLOR_LIGHTGRAY,"USAGE: /me [action]");
format(str,sizeof(str),"*%s %s",name, params);
return 1;
}