SA-MP Forums Archive
Why wont this code 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why wont this code work??? (/showthread.php?tid=186039)



Why wont this code work??? - <Weponz> - 27.10.2010

Код:
		if(!strcmp(cmdtext,"/stealfuel",true))
        {
        if (IsPlayerInCheckpoint(playerid))
        if(waitstealfuel[playerid] == true)
		{
		SendClientMessage(playerid, RED, "[ATT]:Wait Before Stealing Fuel Again!");
		}
		else if(canstealfuel[playerid] == true)
  		{
		    if(stealfuel[playerid] == false)
			{
                new str[128];
                GetPlayerName(playerid, str, sizeof(str));
                format(str, sizeof(str), "[ATT]:%s Is Attemping To Steal Fuel Right Now!", str, cmdtext[4]);
                SendClientMessageToAll(RED, str);
				GameTextForPlayer(playerid, "~w~Stealing Fuel ~r~Please Wait!",10000,5);
				timer1 = SetTimerEx("steal", 10000, false, "d", playerid);
				stealfuel[playerid] = true;
			}
			else
			{
			SendClientMessage(playerid, RED, "[ATT]:You Are Already Stealing Fuel!");
			}
		}
		else
		{
		SendClientMessage(playerid, RED, "[ATT]:You Need To Be In The Checkpoint To Steal Fuel!");
		}
		return 1;
	    }
It should tell them thay have to be in checkpoint when thay /stealfuel anywhere other then the checkpoint..But it isnt?What am i doing wrong? Everything else works fine..


Re: Why wont this code work??? - Whizion - 27.10.2010

Use IsPlayerInCheckpoint.


Re: Why wont this code work??? - <Weponz> - 27.10.2010

Quote:
Originally Posted by Whizion
Посмотреть сообщение
Use IsPlayerInCheckpoint.
I have the rest works fine just it dont say anything when u /stealfuel anywhere but the checkpoints..


Re: Why wont this code work??? - Lorenc_ - 27.10.2010

I'd suggest using the IsPlayerInRangeOfPoint function. Get the cords at the point of the cp and then track if there at the point

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint