SA-MP Forums Archive
Help with Pawno Script Using If - 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: Help with Pawno Script Using If (/showthread.php?tid=67220)



Help with Pawno Script Using If - Alec24 - 27.02.2009

I have a problem where you use the command /flysf to go to San Fiero. It takes $2500 from your money but i need some script so if you dont have enough money you cannot go there.

Currently:
Код:
if (strcmp("/flysf", cmdtext, true, 10) == 0)
	{
		SetPlayerPos(playerid, -96.8143,-1197.3097,2.5853);
		GameTextForPlayer(playerid, "Arrived At San Fiero! (-$2500)",5000,5);   \
		GivePlayerMoney(playerid, -2500);
		return 1;
		}
I have tried:

Код:
if (strcmp("/flysf", cmdtext, true, 10) == 0)
	{
if pocketmoney <=0 then
GameTextForPlayer(playerid, "Not Enough Money!",5000,5);   \
else
		SetPlayerPos(playerid, -96.8143,-1197.3097,2.5853);
		GameTextForPlayer(playerid, "Arrived At San Fiero! (-$2500)",5000,5);   \
		GivePlayerMoney(playerid, -2500);
endif
		return 1;
		}



Re: Help with Pawno Script Using If - ғαιιοцт - 27.02.2009

Код:
	if (strcmp("/flysf", cmdtext, true, 10) == 0)
	{
		if(GetPlayerMoney(playerid) >= 2500)
		{
			SetPlayerPos(playerid, -96.8143,-1197.3097,2.5853);
			GameTextForPlayer(playerid, "Arrived At San Fiero! (-$2500)",5000,5);
			GivePlayerMoney(playerid, -2500);
		}
		else
		{
			SendClientMessage(playerid, COLOR_RED, "You don't have enough money! ($2500)");
		}
		return 1;
	}



Re: Help with Pawno Script Using If - Alec24 - 27.02.2009


error:

Код:
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\Freeroam.pwn(404) : error 017: undefined symbol "COLOR_RED"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Help with Pawno Script Using If - ICECOLDKILLAK8 - 27.02.2009

change COLOR_RED to whatever color you have defined