SA-MP Forums Archive
[HELP]InPlayerInRangeOfPoint[HELP]+REP Who help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]InPlayerInRangeOfPoint[HELP]+REP Who help (/showthread.php?tid=544954)



[HELP]InPlayerInRangeOfPoint[HELP]+REP Who help - Justinclaveria123 - 05.11.2014

Guys , i wondering why this is not works , when i go to the coords it didn't work
heres the code
Код:
COMMAND:buyclothes(playerid, params[])
{
    new skinnumber, skinid, string[128];
    if(sscanf(params, "d", skinid)) SendClientMessage(playerid, -1,"USAGE:/buyclothes [skinid]");
    else if(skinid < 0 || skinid > 299) SendClientMessage(playerid, 0xFF000000, "{ff0000}ERROR: {ffffff}Choose a skin between 0 to 299!");
    else
    {
        if(!IsPlayerInRangeOfPoint(playerid,10,-1883.0410,865.6260,35.1728))
		#pragma unused params
		SetPlayerSkin(playerid, skinid);
        skinnumber = GetPlayerSkin(playerid);
        format(string, sizeof(string), "You buy skin %d for 50$", skinnumber);
        SendClientMessage(playerid, -1, string);
        GivePlayerMoney(playerid, -50);
        return 1;
	}
}



Re: [HELP]InPlayerInRangeOfPoint[HELP]+REP Who help - Mitchelll - 05.11.2014

Try this.

pawn Код:
COMMAND:buyclothes(playerid, params[])
{
    new skinid;
    if(sscanf(params, "d", skinid)) return SendClientMessage(playerid, -1,"USAGE:/buyclothes [skinid]");
    if(skinid < 0 || skinid > 299) return SendClientMessage(playerid, 0xFF000000, "{ff0000}ERROR: {ffffff}Choose a skin between 0 to 299!");
    if(IsPlayerInRangeOfPoint(playerid,10,-1883.0410,865.6260,35.1728)) {
        new string[50];
        SetPlayerSkin(playerid, skinid);
        format(string, sizeof(string), "You bought this skin %d for 50$", GetPlayerSkin(playerid));
        SendClientMessage(playerid, -1, string);
        GivePlayerMoney(playerid, -50);
        return 1;
     }else return SendClientMessage(playerid,  0xFF000000, "{ff0000}ERROR: {ffffff}You are not in the range of point to buy this skin.");
}



Respuesta: [HELP]InPlayerInRangeOfPoint[HELP]+REP Who help - Spreadhaz - 05.11.2014

The error is here:

if(!IsPlayerInRangeOfPoint(playerid,10,-1883.0410,865.6260,35.1728))

change to

if(!IsPlayerInRangeOfPoint(playerid,10.0,-1883.0410,865.6260,35.1728))

The parameter have to be a float, if you put entire numbers in a float parameter, it will set it automatically as 0, then, if you want to put an entire number, you have to ad .0, example, 5 to 5.0


Re: [HELP]InPlayerInRangeOfPoint[HELP]+REP Who help - sammp - 05.11.2014

Are you sure you're within the radius? Change the radius to something like 100 and see if it works then. You should place an icon on that exact co-ordinate too!


Respuesta: Re: [HELP]InPlayerInRangeOfPoint[HELP]+REP Who help - Spreadhaz - 06.11.2014

Quote:
Originally Posted by sammp
Посмотреть сообщение
Are you sure you're within the radius? Change the radius to something like 100 and see if it works then. You should place an icon on that exact co-ordinate too!
also he has to make it to a float, he cannot set an entire number in a float field, if he put 10, it will be taken as 0, so he has to set 10.0 instead of only 10


Re: [HELP]InPlayerInRangeOfPoint[HELP]+REP Who help - Justinclaveria123 - 06.11.2014

Quote:
Originally Posted by Mitchelll
Посмотреть сообщение
Try this.

pawn Код:
COMMAND:buyclothes(playerid, params[])
{
    new skinid;
    if(sscanf(params, "d", skinid)) return SendClientMessage(playerid, -1,"USAGE:/buyclothes [skinid]");
    if(skinid < 0 || skinid > 299) return SendClientMessage(playerid, 0xFF000000, "{ff0000}ERROR: {ffffff}Choose a skin between 0 to 299!");
    if(IsPlayerInRangeOfPoint(playerid,10,-1883.0410,865.6260,35.1728)) {
        new string[50];
        SetPlayerSkin(playerid, skinid);
        format(string, sizeof(string), "You bought this skin %d for 50$", GetPlayerSkin(playerid));
        SendClientMessage(playerid, -1, string);
        GivePlayerMoney(playerid, -50);
        return 1;
     }else return SendClientMessage(playerid,  0xFF000000, "{ff0000}ERROR: {ffffff}You are not in the range of point to buy this skin.");
}
Quote:
Originally Posted by Spreadhaz
Посмотреть сообщение
The error is here:

if(!IsPlayerInRangeOfPoint(playerid,10,-1883.0410,865.6260,35.172)

change to

if(!IsPlayerInRangeOfPoint(playerid,10.0,-1883.0410,865.6260,35.172)

The parameter have to be a float, if you put entire numbers in a float parameter, it will set it automatically as 0, then, if you want to put an entire number, you have to ad .0, example, 5 to 5.0
Quote:
Originally Posted by sammp
Посмотреть сообщение
Are you sure you're within the radius? Change the radius to something like 100 and see if it works then. You should place an icon on that exact co-ordinate too!
Quote:
Originally Posted by Spreadhaz
Посмотреть сообщение
also he has to make it to a float, he cannot set an entire number in a float field, if he put 10, it will be taken as 0, so he has to set 10.0 instead of only 10
Thank you GUys ! + REP ALL OF YOU .

anyway i need help again

i want to make a multiple if(isPlayerInRangeOfPoint(playerid,10.0,X,Y,Z))

can you guys help me?

i think it is using a stock right?


Re: [HELP]InPlayerInRangeOfPoint[HELP]+REP Who help - M0HAMMAD - 06.11.2014

pawn Код:
COMMAND:buyclothes(playerid, params[])
{
    #pragma unused params
    new skinnumber, skinid, string[128];
    if(sscanf(params, "d", skinid))
    {
        SendClientMessage(playerid, -1,"USAGE:/buyclothes [skinid]");
        return 1;
    }
    if(skinid < 0 || skinid > 299)
    {
        SendClientMessage(playerid, 0xFF000000, "{ff0000}ERROR: {ffffff}Choose a skin between 0 to 299!");
        return 1;
    }
    if(!IsPlayerInRangeOfPoint(playerid,10,-1883.0410,865.6260,35.1728))
    {
        SendClientMessage(playerid, 0xFF000000, "{ff0000}ERROR: {ffffff}You must be in ...");
        return 1;
    }
    SetPlayerSkin(playerid, skinid);
    skinnumber = GetPlayerSkin(playerid);
    format(string, sizeof(string), "You buy skin %d for 50$", skinnumber);
    SendClientMessage(playerid, -1, string);
    GivePlayerMoney(playerid, -50);
    return 1;
}



Re: [HELP]InPlayerInRangeOfPoint[HELP]+REP Who help - Justinclaveria123 - 06.11.2014

Quote:
Originally Posted by M0HAMMAD
Посмотреть сообщение
pawn Код:
COMMAND:buyclothes(playerid, params[])
{
    #pragma unused params
    new skinnumber, skinid, string[128];
    if(sscanf(params, "d", skinid))
    {
        SendClientMessage(playerid, -1,"USAGE:/buyclothes [skinid]");
        return 1;
    }
    if(skinid < 0 || skinid > 299)
    {
        SendClientMessage(playerid, 0xFF000000, "{ff0000}ERROR: {ffffff}Choose a skin between 0 to 299!");
        return 1;
    }
    if(!IsPlayerInRangeOfPoint(playerid,10,-1883.0410,865.6260,35.1728))
    {
        SendClientMessage(playerid, 0xFF000000, "{ff0000}ERROR: {ffffff}You must be in ...");
        return 1;
    }
    SetPlayerSkin(playerid, skinid);
    skinnumber = GetPlayerSkin(playerid);
    format(string, sizeof(string), "You buy skin %d for 50$", skinnumber);
    SendClientMessage(playerid, -1, string);
    GivePlayerMoney(playerid, -50);
    return 1;
}


Bro , it's already fixed , but i don't know how to make a multiple range point .

Because i used that for buying a skin , so there are lots of clothes shop everywhere in the map.
Please help


Re: [HELP]InPlayerInRangeOfPoint[HELP]+REP Who help - BroZeus - 06.11.2014

like this -
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,10,X,Y,Z))//replace X Y and Z wiht ur coords
{
//do something
}
else if(IsPlayerInRangeOfPoint(playerid,10,X,Y,Z))//replace X Y and Z wiht ur coords
{
//do something
}
else if(IsPlayerInRangeOfPoint(playerid,10,X,Y,Z))//replace X Y and Z wiht ur coords
{
//do something
}
//.....so on



Re: [HELP]InPlayerInRangeOfPoint[HELP]+REP Who help - Justinclaveria123 - 06.11.2014

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
like this -
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,10,X,Y,Z))//replace X Y and Z wiht ur coords
{
//do something
}
else if(IsPlayerInRangeOfPoint(playerid,10,X,Y,Z))//replace X Y and Z wiht ur coords
{
//do something
}
else if(IsPlayerInRangeOfPoint(playerid,10,X,Y,Z))//replace X Y and Z wiht ur coords
{
//do something
}
//.....so on
Thanks