SA-MP Forums Archive
If he's close to a biz - 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: If he's close to a biz (/showthread.php?tid=444297)



If he's close to a biz - Sellize - 16.06.2013

How can I make the /enter command see at which business he is? I never worked with arrays before so thank you if you could help
Код:
#include <a_samp>

public OnGameModeInit()
{
	print("Business include by Sellize loaded");
	return 1;
}

public OnGameModeExit()
{
    print("Business include by Sellize unloaded");
	return 1;
}

forward CreateBusiness(type, Float:x, Float:y, Float:z, entrancefee);

public CreateBusiness(type, Float:x, Float:y, Float:z, entrancefee)
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/enter", true))
    {
        //
        return 1;
    }
    return 0;
}



Re: If he's close to a biz - bensmart469 - 16.06.2013

You may have something like this in your script:
PHP код:
#define MAX_BIZ 201 
Then, under your /enter cmd, you need to run a loop to see if the player is near one of them.
PHP код:
    for(new i=1i<MAX_BIZi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid2BizInfo[i][bX], BizInfo[i][bY], BizInfo[i][bZ])) //or whatever your biz enum is
        
{
                 
//code
        
}
    }