IsPlayerAtDealership help ??
#1

Hey, I need some help in how to add more dealerships... :S
A friend told me to post in here, and get some help on how to add more dealerships..
Anyways, the code he told me to make with coords is this:

Код:
public IsAtDealership(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	    if(PlayerToPoint(25.0,playerid,3029.8376,-2045.4829,3.4229,7.2077,1,1) || PlayerToPoint(50,playerid,2325.4622,-1223.5625,22.2046,270.8142,161,161) || PlayerToPoint(35,playerid,2149.4558,-1166.3368,23.3749,268.8391,1,146) || PlayerToPoint(50,playerid,2737.8115,-1876.1163,9.4239,359.9999,237,65) || PlayerToPoint(50,playerid,564.1442,-1267.4377,16.8385,0.6290,54,1))
		{
			return 1;
		}
Reply
#2

pawn Код:
#define MAX_POS 5
new DSPos[MAX_POS][3] =
{
    //{X, Y, Z}
    {3029.8376,-2045.4829,3.4229},
    {2325.4622,-1223.5625,22.2046},
    {2149.4558,-1166.3368,23.3749},
    {2737.8115,-1876.1163,9.4239},
    {564.1442,-1267.4377,16.8385}
};

public IsAtDealership(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        for(new d; d<MAX_POS; d++)
        {
            if(IsPlayerInRangeOfPoint(playerid,25.0,DSPos[d][0],DSPos[d][1],DSPos[d][2]))
            {
                return 1;
            }
Reply
#3

Thank you Jeff, but how do I add more coords without ruining the code ?
Reply
#4

pawn Код:
public IsAtDealership(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        for(new d; d<MAX_POS; d++)
        {
            if(IsPlayerInRangeOfPoint(playerid,25.0,DSPos[d][0],DSPos[d][1],DSPos[d][2]) || IsPlayerInRangeOfPoint(playerid,25.0,DSPos[d][0],DSPos[d][1],DSPos[d][2]) || IsPlayerInRangeOfPoint(playerid,25.0,DSPos[d][0],DSPos[d][1],DSPos[d][2]) )
            {
                return 1;
            }
Reply
#5

xemper here
pawn Код:
#define MAX_POS 5
new DSPos[MAX_POS][3] =
{
    //{X, Y, Z}
    {3029.8376,-2045.4829,3.4229},
    {2325.4622,-1223.5625,22.2046},
    {2149.4558,-1166.3368,23.3749},
    {2737.8115,-1876.1163,9.4239},
    {564.1442,-1267.4377,16.8385}
};
if u add more just change
pawn Код:
#define MAX_POS 5
to
pawn Код:
#define MAX_POS how_many
and u add another line under
pawn Код:
{564.1442,-1267.4377,16.8385},
{NEXT COORDS}
at the end dont give ","
Reply
#6

I'll try that Jeff.
Reply
#7

Okay I THINK it worked, but anyways, the message by the car price etc doesnt show up, and I would like to know if my code is wrong or something..

pawn Код:
if(IsAnOwnableCar(newcar))
        {
            if(CarInfo[newcar][cOwned]==0)
            {
                TogglePlayerControllable(playerid, 0);
                format(string,sizeof(string),"~w~Vehicle: %s~n~Price: ~g~%d~n~~w~/buycar to buy this vehicle~n~~r~/exit ~w~to exit this vehicle",CarInfo[newcar][cDescription],CarInfo[newcar][cValue]);
                GameTextForPlayer(playerid,string,5000,5);
            }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)