error 035: argument type mismatch (argument 2)
#1

Hi,

I followed an topic about making an shop.. but I have 2 bases and 2 teams..
So I made this..

Код:
CMD:weapons(playerid, params[])
{
	new range[100];
	if(GetPlayerTeam(playerid) == 1) //red
	{
	    range = "-507.8125, 2107.421875, -267.578125, 2316.40625";
	}
	else if(GetPlayerTeam(playerid) == 2) // blue
	{
	    range = "3.90625, 1656.25,382.8125, 2121.0975";
	}
	else
	{
	    SendClientMessage(playerid, -1, "You first choose a team and then you can try it again ;).");
	}
    if(IsPlayerInRangeOfPoint(playerid, range))
    {
    	ShowPlayerDialog(playerid, SHOP_DIALOG, DIALOG_STYLE_LIST, "Weapon Shop", "Deagle: $500\nSawn-Off: $1000\nM4: $2000\nSniper: $3000", "Select", "Exit");//Show them the dialog.
    	return true;
    }
    else
    {
        SendClientMessage(playerid, -1, "You must be at your own base to buy weapons.");
    }
	return true;
}
Error: error 035: argument type mismatch (argument 2)

The error is on this line:
Код:
if(IsPlayerInRangeOfPoint(playerid, range))
Some help please?
Reply
#2

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 3.90625, 1656.25,382.8125, 2121.0975))
Try this.
Reply
#3

You can't do like that! Just do like this:

pawn Код:
CMD:weapons(playerid, params[])
{
    static Float:_range, Float:posX, Float:posY, Float:posZ;

    if(GetPlayerTeam(playerid) == 1) //red
    {
        _range = "-507.8125", posX = "2107.421875", posY = "-267.578125", posZ = "2316.40625";
    }
    else if(GetPlayerTeam(playerid) == 2) // blue
    {
        _range = "3.90625", posX = "1656.25", posY = "382.8125", posZ = "2121.0975";
    }
    else
    {
        SendClientMessage(playerid, -1, "You first choose a team and then you can try it again ;).");
    }
    if(IsPlayerInRangeOfPoint(playerid, _range, posX, posY, posZ))
    {
        ShowPlayerDialog(playerid, SHOP_DIALOG, DIALOG_STYLE_LIST, "Weapon Shop", "Deagle: $500\nSawn-Off: $1000\nM4: $2000\nSniper: $3000", "Select", "Exit");//Show them the dialog.
        return true;
    }
    else
    {
        SendClientMessage(playerid, -1, "You must be at your own base to buy weapons.");
    }
    return true;
}
Reply
#4

Quote:
Originally Posted by [vTc]Patroool
Посмотреть сообщение
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 3.90625, 1656.25,382.8125, 2121.0975))
Try this.
There are 2 teams.. I do not want them to buy weapons in the base thats not their..
Reply
#5

It's parameter is IsPlayerInRangeOfPoint(playerid,range, Float: x, Float:y,Float:z)
Reply
#6

Quote:
Originally Posted by Hanuman
Посмотреть сообщение
It's parameter is IsPlayerInRangeOfPoint(playerid,range, Float: x, Float:y,Float:z)
Variable rang has that..
Reply
#7

Nope, it won't work like that.
Reply
#8

pawn Код:
if(GetPlayerTeam(playerid) == 1) //red
    {
        if(IsPlayerInRangeOfPoint(playerid, -507.8125, 2107.421875, -267.578125, 2316.40625))
        {
            ShowPlayerDialog(playerid, SHOP_DIALOG, DIALOG_STYLE_LIST, "Weapon Shop", "Deagle: $500\nSawn-Off: $1000\nM4: $2000\nSniper: $3000", "Select", "Exit");//Show them the dialog.
            return true;
        }
    }
    else if(GetPlayerTeam(playerid) == 2) // blue
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.90625, 1656.25,382.8125, 2121.0975))
        {
            ShowPlayerDialog(playerid, SHOP_DIALOG, DIALOG_STYLE_LIST, "Weapon Shop", "Deagle: $500\nSawn-Off: $1000\nM4: $2000\nSniper: $3000", "Select", "Exit");//Show them the dialog.
            return true;
        }
    }
Or u need to do it like this!

Note: range can't have negative value(-507.8125).
Reply
#9

pawn Код:
IsPlayerInRangeOfPoint(playerid, 3.90625, 1656.25,382.8125, 2121.0975) || IsPlayerInRangeOfPoint(playerid, -507.8125, 2107.421875, -267.578125, 2316.40625))
Try this, I am confused here || or && ?
Reply
#10

Quote:
Originally Posted by Hanuman
Посмотреть сообщение
Nope it won't work like that
I guess I fixed it!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)