Need to Convert to Zcmd. Thanks!
#1

PHP код:
dcmd_bounty(playeridparams[])
{
    if (
PlayerInfo[playerid][pSpawn] == 1)
    {
    new 
idx,giveplayerid,money,string[256],tmp[256];
    
tmp strtok(paramsidx);
    if(!
strlen(tmp))
    {
    
SendClientMessage(playeridCOLOR_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(stringsizeof(string), "%d Is Not A Valid ID."giveplayerid);
    
SendClientMessage(playeridCOLOR_ERRORstring);
    return 
1;
    }
    }
    
tmp strtok(paramsidx);
    if(!
strlen(tmp))
    {
    
SendClientMessage(playeridCOLOR_ERROR"USAGE: /hit (Name/Id) (amount).");
    return 
1;
    }
    
money strval(tmp);
    if (
PlayerInfo[playerid][pBountyPlacedOn] == giveplayerid)
    {
    
format(stringsizeof(string), "You Have Already Place A Hit On %s (%d) For $%d",PlayerInfo[giveplayerid][pName],giveplayerid,PlayerInfo[giveplayerid][pBounty]);
    
SendClientMessage(playeridCOLOR_ERRORstring);
    return 
1;
    }
    if (
PlayerInfo[playerid][pBountyPlacedOn] > -1)
    {
    
SendClientMessage(playeridCOLOR_ERROR"You Already Placed A Hit On Someone, Type /cancelhit To Cancel The Hit Contract.");
    return 
1;
    }
    if(
giveplayerid == playerid)
    {
    
SendClientMessage(playeridCOLOR_ERROR"You Cannot Place A Hit On Yourself.");
    return 
1;
    }
    if (
IsPlayerNPC(giveplayerid))
    {
    
SendClientMessage(playeridCOLOR_ERROR"You Cannot Place A Hit Contract On A Bot.");
    return 
1;
    }
    if (
PlayerInfo[playerid][pSpawn] == 0){
    
format(stringsizeof(string), "%s (%i) Has Not Spawned.",PlayerInfo[giveplayerid][pName],giveplayerid);
    
SendClientMessage(playeridCOLOR_ERRORstring);
    return 
1;
    }
    if (
money 10000){
    
SendClientMessage(playeridCOLOR_ERROR"Hitmen Don't Work For Less Than $10000.");
    return 
1;
    }
    if (
GetPlayerMoney(playerid) < money)
    {
    
format(stringsizeof(string), "You Can't Afford To Place A Hit Contract On %s (%d) For $%d.",PlayerInfo[giveplayerid][pName],giveplayerid,money);
    
SendClientMessage(playeridCOLOR_ERRORstring);
    return 
1;
    }
    
format(stringsizeof(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_MSGstring);
    
format(stringsizeof(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_MSGstring);
    
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"Type  /cancelhit (Name/Id)  To Cancel A Hit Contract.");
    
format(stringsizeof(string), "~w~HIT CONTRACT PLACED ON~n~%s FOR $%d",PlayerInfo[giveplayerid][pName],money);
    
GameTextForPlayer(playerid,string50003);
    if (
PlayerInfo[playerid][pTeam] != TEAM_LAW && PlayerInfo[playerid][pJailed] == && PlayerInfo[playerid][pVigilante] == 0)
    {
    
PlayerInfo[playerid][pWantedLevel] ++;
    
SetPlayerWantedStats(playerid,"Ordering A Hit Contract");
    }
    
format(stringsizeof(string), "%s Has Placed A Hit On You For $%d.",PlayerInfo[playerid][pName],money);
    
SendClientMessage(giveplayerid,COLOR_SERVER_HELP_MSGstring);
    
format(stringsizeof(string), "~w~HIT CONTRACT PLACED ON YOU",PlayerInfo[playerid][pName]);
    
GameTextForPlayer(giveplayerid,string50004);
    
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(playeridCOLOR_ERROR"You Cannot Use This Command When You're Dead.");
    }
    return 
1;
}
//==============================================================================
dcmd_cancelhit(playeridparams[])
{
#pragma unused params
    
if (PlayerInfo[playerid][pSpawn] == 1){
    if (
PlayerInfo[playerid][pBountyPlacedOn] > -1)
    {
    new 
string[256], giveplayerid PlayerInfo[playerid][pBountyPlacedOn];
    
format(stringsizeof(string), "~w~HIT CONTRACT ON ~b~%s~n~~r~CANCELLED",PlayerInfo[giveplayerid][pName]);
    
GameTextForPlayer(playerid,string50003);
    
format(stringsizeof(string), "You Have Cancelled The Hit Contract On %s (%d).",PlayerInfo[giveplayerid][pName],giveplayerid);
    
SendClientMessage(playeridCOLOR_SERVER_HELP_MSGstring);
    
format(stringsizeof(string), "Your $%d Hit Fee Has Been Returned, Minus A 25 Percent Processing Fee.",PlayerInfo[giveplayerid][pBounty]);
    
SendClientMessage(playeridCOLOR_SERVER_HELP_MSGstring);
    
format(stringsizeof(string), "The Hit Contract On %s (%d) Has Been Cancelled (Cancelled).",PlayerInfo[giveplayerid][pName],giveplayerid);
    
SendClientMessageToSkill(TEAM_CIVILIANCOLOR_SERVER_HELP_MSGstring);
    
format(stringsizeof(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_MSGstring);
    
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(playeridCOLOR_ERROR"You Havn't Placed Any Hits.");
    }
    }else{
    
SendClientMessage(playeridCOLOR_ERROR"You Cannot Use This Command When You're Dead.");
    }
    return 
1;
}
//==============================================================================
dcmd_hits(playeridparams[])
{
#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 
0GetMaxPlayers(); i++)
    {
        if(
IsPlayerConnected(i) && PlayerInfo[i][pSpawn] == && PlayerInfo[i][pBounty] > 0)
        {
        
//&& !IsPlayerNPC(i)
        
HitContracts ++;
        
CurrentLine ++;
        if (
CurrentLine 10)
        {
        if (
CurrentLine LastLine)
        {
        
format(stringsizeof(string), "~y~%s (%i)",PlayerInfo[i][pName],i);
        
strmid(Line[CurrentLine], string0strlen(string), 256);
        
format(stringsizeof(string), "~g~$%i",PlayerInfo[i][pBounty]);
        
strmid(LineEx[CurrentLine], string0strlen(string), 256);
        }else{
        
format(stringsizeof(string), " ");
        
strmid(Line[CurrentLine], string0strlen(string), 256);
        
strmid(LineEx[CurrentLine], string0strlen(string), 256);
        }
        
LastLine CurrentLine;
        }
        }
    }
    if (
HitContracts 0)
    {
    
TextDrawHideForPlayer(playeridMenu_Title[playerid]);
    
TextDrawHideForPlayer(playeridMenu_Stats[playerid]);
    
TextDrawHideForPlayer(playeridMenu_End[playerid]);
    for(new 
0MAX_TEXTDRAW_ROWSr++)
    {
    
TextDrawHideForPlayer(playeridMenu_Column1[playerid][r]);
    
TextDrawHideForPlayer(playeridMenu_Column2[playerid][r]);
    }
     
ShowTextDrawMenu(playeridTD_MENU_INFO,"~g~Hit Contracts"CurrentLine 30);
    
ShowTextDrawMenuItems(playerid0" "" "" ",0);
    
ShowTextDrawMenuItems(playerid1" "Line[0], LineEx[0],0);
    
ShowTextDrawMenuItems(playerid2" "Line[1], LineEx[1],0);
    
ShowTextDrawMenuItems(playerid3" "Line[2], LineEx[2],0);
    
ShowTextDrawMenuItems(playerid4" "Line[3], LineEx[3],0);
    
ShowTextDrawMenuItems(playerid5" "Line[4], LineEx[4],0);
    
ShowTextDrawMenuItems(playerid6" "Line[5], LineEx[5],0);
    
ShowTextDrawMenuItems(playerid7" "Line[6], LineEx[6],0);
    
ShowTextDrawMenuItems(playerid8" "Line[7], LineEx[7],0);
    
ShowTextDrawMenuItems(playerid9" "Line[8], LineEx[8],0);
    
ShowTextDrawMenuItems(playerid10" "Line[9], LineEx[9],0);
    }else{
    
SendClientMessage(playeridCOLOR_ERROR"There Are No Hit Contracts At The Moment.");
    }
    }else{
    
SendClientMessage(playeridCOLOR_ERROR"Only Hitmen Can Look At The List Of Hit Contracts.");
    }
    }else{
    
SendClientMessage(playeridCOLOR_ERROR"You Cannot Use This Command When You're Dead.");
    }
    return 
1;

Reply
#2

https://sampforum.blast.hk/showthread.php?tid=576114

https://sampforum.blast.hk/showthread.php?tid=91354

Both these threads explain how to use ZCMD.

It is very simple to change from dcmd to ZCMD.

Change dcmd_ with CMD: everywhere.

For example,
Код:
dcmd_bounty(playerid, params[])
change it to
Код:
CMD:bounty(playerid, params[])
Reply
#3

A simple way:
  1. Open your compiler (PAWNO)
  2. Press key combination: CTRL + H (Find and replace)
  3. Input in the first box (find): dcmd_ (make sure the case is sensitive
  4. Input in the second box (replace): CMD:
  5. Done, replace all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)