SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/05/2013, 12:24 PM   #1
Nostrum
Big Clucker
 
Join Date: Apr 2013
Posts: 59
Reputation: -2
Default Converting strcmp to zcmd

Hello community, could someone convert these commands to zcmd and highlight the places which you have changed so i would know?

pawn Code:
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;
    }
Nostrum is offline   Reply With Quote
Old 15/05/2013, 12:33 PM   #2
mahdi499
Big Clucker
 
mahdi499's Avatar
 
Join Date: Aug 2009
Location: Palestine
Posts: 165
Reputation: 9
Default Re: Converting strcmp to zcmd

i suppose this is it

pawn Code:
CMD:bizfee(playerid, params[])
    {
        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;
    }
CMD:extortion(playerid, params[])
    {
        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;
    }
CMD:bizname(playerid, params[])
    {
        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;
    }
CMD:bizwithdraw(playerid, params[])
    {
        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;
    }
CMD:sellbiz(playerid, params[])
    {
        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;
    }
CMD:bizdeposit(playerid, params[])
    {
        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;
    }
mahdi499 is offline   Reply With Quote
Old 15/05/2013, 12:39 PM   #3
Nostrum
Big Clucker
 
Join Date: Apr 2013
Posts: 59
Reputation: -2
Default Re: Converting strcmp to zcmd

Cant be
pawn Code:
tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
These are strcmp things that needs to be converted as well, arent they?
Nostrum is offline   Reply With Quote
Old 15/05/2013, 12:39 PM   #4
DeMoX
Big Clucker
 
DeMoX's Avatar
 
Join Date: May 2013
Location: Planet-X
Posts: 174
Reputation: 5
Default Re: Converting strcmp to zcmd

Dude, bofore using an include you might like to Read the topic so you'll inderstand everything about it.
__________________
DeMoX is offline   Reply With Quote
Old 15/05/2013, 12:42 PM   #5
mahdi499
Big Clucker
 
mahdi499's Avatar
 
Join Date: Aug 2009
Location: Palestine
Posts: 165
Reputation: 9
Default Re: Converting strcmp to zcmd

@Nostrum, you need sscanf to use ZCMD anyways,you can't use zcmd without sscanf
mahdi499 is offline   Reply With Quote
Old 15/05/2013, 12:49 PM   #6
mahdi499
Big Clucker
 
mahdi499's Avatar
 
Join Date: Aug 2009
Location: Palestine
Posts: 165
Reputation: 9
Default Re: Converting strcmp to zcmd

Quote:
Originally Posted by ****** View Post
Sure you can! They're nothing to do with each other. One processes commands, the other extracts information from strings - it just so happens that many people frequently want to do those two things at the same time.

Oh Ok,Thanks for the information,we don't learn if we make mistakes right?
Thank you again

Off topic: Omg , ****** replied to me :P
mahdi499 is offline   Reply With Quote
Old 15/05/2013, 01:15 PM   #7
Nostrum
Big Clucker
 
Join Date: Apr 2013
Posts: 59
Reputation: -2
Default Re: Converting strcmp to zcmd

So what you guys are saying is
Code:
tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
is sscanf and doesnt need to be touched?
Nostrum is offline   Reply With Quote
Old 15/05/2013, 01:18 PM   #8
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,884
Reputation: 1321
Default Re: Converting strcmp to zcmd

Just pointing out...

You don't need this check if(IsPlayerConnected(playerid))
Pottus is offline   Reply With Quote
Old 15/05/2013, 01:44 PM   #9
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,068
Reputation: 2658
Default Re: Converting strcmp to zcmd

Quote:
Originally Posted by Nostrum View Post
So what you guys are saying is
Code:
tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
is sscanf and doesnt need to be touched?
What we're saying is that you should change it, but it actually doesn't have to be changed.
__________________
Vince is offline   Reply With Quote
Old 15/05/2013, 02:07 PM   #10
Nostrum
Big Clucker
 
Join Date: Apr 2013
Posts: 59
Reputation: -2
Default Re: Converting strcmp to zcmd

Quote:
Originally Posted by Vince View Post
What we're saying is that you should change it, but it actually doesn't have to be changed.
And what should i be changing it to? :
Nostrum is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting from ZCMD to Strcmp Stanford Scripting Help 12 24/03/2013 07:56 PM
Help on converting strcmp to zcmd! Uberanwar Scripting Help 3 13/11/2012 02:27 AM
Converting ZCMD To STRCMP Anters14 Scripting Help 5 01/07/2012 01:13 AM
Converting ZCMD to STRCMP [HELP]!!! Smacky Scripting Help 1 27/03/2012 04:22 PM
Need help with Converting! [ ZCMD to STRCMP ] Genuine Life Roleplay Scripting Help 7 21/02/2012 04:46 AM


All times are GMT. The time now is 02:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.