SA-MP Forums Archive
/buydriving not work - 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: /buydriving not work (/showthread.php?tid=337497)



/buydriving not work - MrBlake - 26.04.2012

Hi, i have the command /buydriving, for buy a driving license, but isnt work:

Код:
if(strcmp(cmd, "/buydriving", true) == 0)
	{
		if(IsPlayerConnected(playerid))
       	{
			if(PlayerToPoint(3.0,playerid,1412.3163,-1701.7324,13.5395))
          	{
            	if(PlayerInfo[playerid][pCarLic] == 0)
				{
				    if(GetPlayerMoney(playerid) < 5000)
				    {
             			SendClientMessage(playerid, COLOR_GREY, "You don't have enough money for a driving license");
             			return 1;
					}
					else
					{
             			SendClientMessage(playerid, COLOR_LIGHTBLUE, "You bought a driving License for $5000");
             			SafeGivePlayerMoney(playerid, - 5000);
             			PlayerInfo[playerid][pCarLic] = 1;
             			OnPlayerUpdate(playerid);
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_LIGHTBLUE, " You already own a driving license");
					return 1;
				}
			}
		}
  		return 1;
	}
What's wrong?

I was at this coordonates and nothing happened.

When I type /buydriving nothing appear on the chat .
WTF?


Re: /buydriving not work - MadSkillz - 26.04.2012

Код:
if(strcmp(cmd, "/buydriving", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		if(PlayerToPoint(3.0,playerid,1412.3163,-1701.7324,13.5395))
        {
			if(PlayerInfo[playerid][pCarLic] == 0)
			{
				if(GetPlayerMoney(playerid) < 5000)
				{
					SendClientMessage(playerid, COLOR_GREY, "You don't have enough money for a driving license");
             		return 1;
				}
				else
				{
					SendClientMessage(playerid, COLOR_LIGHTBLUE, "You bought a driving License for $5000");
             		SafeGivePlayerMoney(playerid, - 5000);
             		PlayerInfo[playerid][pCarLic] = 1;
             		OnPlayerUpdate(playerid);
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, " You already own a driving license");
				return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are not near the license center");
			return 1;
		}
	}
  	return 1;
}
I added another "else" into your script which will tell you if your near that target or not. If the message saying your not close enough keeps showing then there is something clearly wrong with your coordinates

>Untested<


Re: /buydriving not work - MrBlake - 26.04.2012

Hmm i checked the coordonates and you are right. The pickup and the command dont have the same coordonates.

I solved this problem. Thanks