cmd:sellbiz help
#1

i converted this command to ZCMD it was DCMD but am getting this error i cant seem to fix issus due to i really dont no much about DCMD only ZCMD


: warning 219: local variable "SpawnedBusinesses" shadows a variable at a preceding level
: error 017: undefined symbol "tmp"
: error 017: undefined symbol "strtok"
: error 017: undefined symbol "tmp"
: error 017: undefined symbol "giveplayerid"
: error 017: undefined symbol "tmp"
: error 017: undefined symbol "tmp"
: error 017: undefined symbol "strtok"
: error 017: undefined symbol "tmp"
: error 017: undefined symbol "tmp"
: error 017: undefined symbol "giveplayerid"
: error 017: undefined symbol "giveplayerid"
: error 017: undefined symbol "giveplayerid"
: error 017: undefined symbol "giveplayerid"
: error 017: undefined symbol "giveplayerid"
: error 017: undefined symbol "giveplayerid"
: error 017: undefined symbol "giveplayer"
: error 029: invalid expression, assumed zero


Код:
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;
	}
Reply
#2

Hello Yves , try this

pawn Код:
CMD:sellbiz(playerid, params[])
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pPbiskey] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You don't own a Business!");
                return 1;
            }
            new Index;
            tmp = strtok(params,Index);
            tmp2 = strtok(params, Index);
            if(isnull(params))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellbiz [PlayerID/PartOfName] [price]");
                return 1;
            }
            new money, giveplayerid;
            giveplayerid = ReturnUser(tmp);
            money = strval(tmp2);
            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;
    }
Reply
#3

Thanks mate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)