Need to Convert to Zcmd. Thanks! -
PHP код:
dcmd_bounty(playerid, params[])
{
if (PlayerInfo[playerid][pSpawn] == 1)
{
new idx,giveplayerid,money,string[256],tmp[256];
tmp = strtok(params, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /hit (Name/Id) (amount).");
return 1;
}
if(!isNumeric(tmp))
{
giveplayerid = ReturnUser(tmp);
if(giveplayerid == INVALID_PLAYER_ID)
{
return 1;
}
}
else
{
giveplayerid = strval(tmp);
if(!IsPlayerConnected(giveplayerid))
{
format(string, sizeof(string), "%d Is Not A Valid ID.", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
}
tmp = strtok(params, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /hit (Name/Id) (amount).");
return 1;
}
money = strval(tmp);
if (PlayerInfo[playerid][pBountyPlacedOn] == giveplayerid)
{
format(string, sizeof(string), "You Have Already Place A Hit On %s (%d) For $%d",PlayerInfo[giveplayerid][pName],giveplayerid,PlayerInfo[giveplayerid][pBounty]);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
if (PlayerInfo[playerid][pBountyPlacedOn] > -1)
{
SendClientMessage(playerid, COLOR_ERROR, "You Already Placed A Hit On Someone, Type /cancelhit To Cancel The Hit Contract.");
return 1;
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Place A Hit On Yourself.");
return 1;
}
if (IsPlayerNPC(giveplayerid))
{
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Place A Hit Contract On A Bot.");
return 1;
}
if (PlayerInfo[playerid][pSpawn] == 0){
format(string, sizeof(string), "%s (%i) Has Not Spawned.",PlayerInfo[giveplayerid][pName],giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
if (money < 10000){
SendClientMessage(playerid, COLOR_ERROR, "Hitmen Don't Work For Less Than $10000.");
return 1;
}
if (GetPlayerMoney(playerid) < money)
{
format(string, sizeof(string), "You Can't Afford To Place A Hit Contract On %s (%d) For $%d.",PlayerInfo[giveplayerid][pName],giveplayerid,money);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
format(string, sizeof(string), "~b~%s (%i) ~w~Has Placed A ~r~Hit ~w~On ~b~%s (%i) ~w~For ~g~$%d~w~.",PlayerInfo[playerid][pName],playerid,PlayerInfo[giveplayerid][pName],giveplayerid,money);
SendClientMessageToAll(COLOR_SERVER_HELP_MSG, string);
format(string, sizeof(string), "You Have Placed A Hit Contract On %s (%d) For $%d. The Contract Will Last 48 Hours.",PlayerInfo[giveplayerid][pName],giveplayerid,money);
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG, string);
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG, "Type /cancelhit (Name/Id) To Cancel A Hit Contract.");
format(string, sizeof(string), "~w~HIT CONTRACT PLACED ON~n~%s FOR $%d",PlayerInfo[giveplayerid][pName],money);
GameTextForPlayer(playerid,string, 5000, 3);
if (PlayerInfo[playerid][pTeam] != TEAM_LAW && PlayerInfo[playerid][pJailed] == 0 && PlayerInfo[playerid][pVigilante] == 0)
{
PlayerInfo[playerid][pWantedLevel] ++;
SetPlayerWantedStats(playerid,"Ordering A Hit Contract");
}
format(string, sizeof(string), "%s Has Placed A Hit On You For $%d.",PlayerInfo[playerid][pName],money);
SendClientMessage(giveplayerid,COLOR_SERVER_HELP_MSG, string);
format(string, sizeof(string), "~w~HIT CONTRACT PLACED ON YOU",PlayerInfo[playerid][pName]);
GameTextForPlayer(giveplayerid,string, 5000, 4);
GivePlayerMoney(playerid,-money);
PlayerInfo[playerid][pBountyPlacedOn] = giveplayerid;
PlayerInfo[giveplayerid][pBounty] = money;
PlayerInfo[giveplayerid][pBountyHour] = 48;
PlayerInfo[giveplayerid][pBountyMinute] = 0;
PlayerInfo[giveplayerid][pBountyPlacedBy] = playerid;
PlayerInfo[giveplayerid][pHitsReceived] ++;
PlayerInfo[playerid][pHitsPlaced] ++;
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead.");
}
return 1;
}
//==============================================================================
dcmd_cancelhit(playerid, params[])
{
#pragma unused params
if (PlayerInfo[playerid][pSpawn] == 1){
if (PlayerInfo[playerid][pBountyPlacedOn] > -1)
{
new string[256], giveplayerid = PlayerInfo[playerid][pBountyPlacedOn];
format(string, sizeof(string), "~w~HIT CONTRACT ON ~b~%s~n~~r~CANCELLED",PlayerInfo[giveplayerid][pName]);
GameTextForPlayer(playerid,string, 5000, 3);
format(string, sizeof(string), "You Have Cancelled The Hit Contract On %s (%d).",PlayerInfo[giveplayerid][pName],giveplayerid);
SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, string);
format(string, sizeof(string), "Your $%d Hit Fee Has Been Returned, Minus A 25 Percent Processing Fee.",PlayerInfo[giveplayerid][pBounty]);
SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, string);
format(string, sizeof(string), "The Hit Contract On %s (%d) Has Been Cancelled (Cancelled).",PlayerInfo[giveplayerid][pName],giveplayerid);
SendClientMessageToSkill(TEAM_CIVILIAN, COLOR_SERVER_HELP_MSG, string);
format(string, sizeof(string), "~b~%s (%i) ~w~Has ~r~Cancelled ~w~The ~r~Hit ~w~On ~b~%s (%i)~w~.",PlayerInfo[playerid][pName],playerid,PlayerInfo[giveplayerid][pName],giveplayerid);
SendClientMessageToAll(COLOR_SERVER_HELP_MSG, string);
GivePlayerMoney(playerid,PlayerInfo[giveplayerid][pBounty]);
PlayerInfo[giveplayerid][pBounty] = 0;
PlayerInfo[giveplayerid][pBountyHour] = 0;
PlayerInfo[giveplayerid][pBountyMinute] = 0;
PlayerInfo[giveplayerid][pBountyPlacedBy] = -1;
PlayerInfo[playerid][pBountyPlacedOn] = -1;
}else{
SendClientMessage(playerid, COLOR_ERROR, "You Havn't Placed Any Hits.");
}
}else{
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead.");
}
return 1;
}
//==============================================================================
dcmd_hits(playerid, params[])
{
#pragma unused params
if (PlayerInfo[playerid][pSpawn] == 1){
if (PlayerInfo[playerid][pSkill] == TEAM_CIVILIAN){
new HitContracts,CurrentLine,LastLine,string[256],Line[10][160],LineEx[10][20];
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i) && PlayerInfo[i][pSpawn] == 1 && PlayerInfo[i][pBounty] > 0)
{
//&& !IsPlayerNPC(i)
HitContracts ++;
CurrentLine ++;
if (CurrentLine < 10)
{
if (CurrentLine > LastLine)
{
format(string, sizeof(string), "~y~%s (%i)",PlayerInfo[i][pName],i);
strmid(Line[CurrentLine], string, 0, strlen(string), 256);
format(string, sizeof(string), "~g~$%i",PlayerInfo[i][pBounty]);
strmid(LineEx[CurrentLine], string, 0, strlen(string), 256);
}else{
format(string, sizeof(string), " ");
strmid(Line[CurrentLine], string, 0, strlen(string), 256);
strmid(LineEx[CurrentLine], string, 0, strlen(string), 256);
}
LastLine = CurrentLine;
}
}
}
if (HitContracts > 0)
{
TextDrawHideForPlayer(playerid, Menu_Title[playerid]);
TextDrawHideForPlayer(playerid, Menu_Stats[playerid]);
TextDrawHideForPlayer(playerid, Menu_End[playerid]);
for(new r = 0; r < MAX_TEXTDRAW_ROWS; r++)
{
TextDrawHideForPlayer(playerid, Menu_Column1[playerid][r]);
TextDrawHideForPlayer(playerid, Menu_Column2[playerid][r]);
}
ShowTextDrawMenu(playerid, TD_MENU_INFO,"~g~Hit Contracts", CurrentLine + 3, 0);
ShowTextDrawMenuItems(playerid, 0, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 1, " ", Line[0], LineEx[0],0);
ShowTextDrawMenuItems(playerid, 2, " ", Line[1], LineEx[1],0);
ShowTextDrawMenuItems(playerid, 3, " ", Line[2], LineEx[2],0);
ShowTextDrawMenuItems(playerid, 4, " ", Line[3], LineEx[3],0);
ShowTextDrawMenuItems(playerid, 5, " ", Line[4], LineEx[4],0);
ShowTextDrawMenuItems(playerid, 6, " ", Line[5], LineEx[5],0);
ShowTextDrawMenuItems(playerid, 7, " ", Line[6], LineEx[6],0);
ShowTextDrawMenuItems(playerid, 8, " ", Line[7], LineEx[7],0);
ShowTextDrawMenuItems(playerid, 9, " ", Line[8], LineEx[8],0);
ShowTextDrawMenuItems(playerid, 10, " ", Line[9], LineEx[9],0);
}else{
SendClientMessage(playerid, COLOR_ERROR, "There Are No Hit Contracts At The Moment.");
}
}else{
SendClientMessage(playerid, COLOR_ERROR, "Only Hitmen Can Look At The List Of Hit Contracts.");
}
}else{
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead.");
}
return 1;
}
Re: Need to Convert to Zcmd. Thanks! -
Both these threads explain how to use ZCMD.
It is very simple to change from dcmd to ZCMD.
Change dcmd_ with CMD: everywhere.
Re: Need to Convert to Zcmd. Thanks! -