SA-MP Forums Archive
Help - 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: Help (/showthread.php?tid=575460)



Help - BlackEvils - 27.05.2015

if(strcmp("/capture", cmdtext, true, 10) == 0)
{
if(InDm[playerid] >= 1) return SendClientMessage(playerid,0xFF0000FF,"ERROR:You can't use this command in a dm/event.");
if(PlayerInfo[playerid][gangid] == 0) return SendClientMessage(playerid,COLORE_ROSSO,"ERROR:You are not in any gang.");
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1975.5731, -1249.5286, 20.383)//gang 1
if(Count <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
{
Count = 20;
if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang1, 0xFFFFFF96);
if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang1, 0x80000096);
if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
KillTimer(MyTimer[playerid]);
MyTimer[playerid] = SetTimerEx("TestFunction", 1000, 1, "i", playerid);
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1104.9656, 992.6399, 30.7290))//gang 2
if(Counta <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
{
Counta = 20;
if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang2, 0xFFFFFF96);
if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang2, 0x80000096);
if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
KillTimer(MyTimera[playerid]);
MyTimera[playerid] = SetTimerEx("TestFunctiona", 1000, 1, "i", playerid);
}
return 1;
}

What make this warn "warning 225: unreachable code"


Re: Help - LMaxCo - 27.05.2015

Where's the line of the warning?


Re: Help - BlackEvils - 27.05.2015

Quote:
Originally Posted by LMaxCo
Посмотреть сообщение
Where's the line of the warning?
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1104.9656, 992.6399, 30.7290))//gang 2


Re: Help - LMaxCo - 27.05.2015

Try this

Код:
if(strcmp("/capture", cmdtext, true, 10) == 0)
{
if(InDm[playerid] >= 1) return SendClientMessage(playerid,0xFF0000FF,"ERROR:You can't use this command in a dm/event.");
if(PlayerInfo[playerid][gangid] == 0) return SendClientMessage(playerid,COLORE_ROSSO,"ERROR:You are not in any gang.");
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1975.5731, -1249.5286, 20.383)//gang 1
if(Count <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
{
Count = 20;
if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang1, 0xFFFFFF96);
if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang1, 0x80000096);
if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
KillTimer(MyTimer[playerid]);
MyTimer[playerid] = SetTimerEx("TestFunction", 1000, 1, "i", playerid);
return 1;
{
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1104.9656, 992.6399, 30.7290))//gang 2
if(Counta <= 19) 
return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
}
Counta = 20;
if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang2, 0xFFFFFF96);
if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang2, 0x80000096);
if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
KillTimer(MyTimera[playerid]);
MyTimera[playerid] = SetTimerEx("TestFunctiona", 1000, 1, "i", playerid);
}
return 1;
}



Re: Help - X337 - 27.05.2015

Try this code, missing brackets.
Код:
if(strcmp("/capture", cmdtext, true, 10) == 0)
{
if(InDm[playerid] >= 1) return SendClientMessage(playerid,0xFF0000FF,"ERROR:You can't use this command in a dm/event.");
if(PlayerInfo[playerid][gangid] == 0) return SendClientMessage(playerid,COLORE_ROSSO,"ERROR:You are not in any gang.");
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1975.5731, -1249.5286, 20.383)//gang 1
{
if(Count <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
Count = 20;
if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang1, 0xFFFFFF96);
if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang1, 0x80000096);
if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
KillTimer(MyTimer[playerid]);
MyTimer[playerid] = SetTimerEx("TestFunction", 1000, 1, "i", playerid);
}
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1104.9656, 992.6399, 30.7290))//gang 2
{
if(Counta <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
Counta = 20;
if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang2, 0xFFFFFF96);
if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang2, 0x80000096);
if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
KillTimer(MyTimera[playerid]);
MyTimera[playerid] = SetTimerEx("TestFunctiona", 1000, 1, "i", playerid);
}
return 1;
}
And you forgot to add ")" on :
Код:
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1975.5731, -1249.5286, 20.383)//gang 1



Re: Help - mamorunl - 27.05.2015

Код:
if(Count <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
{
This is never going to work


Re: Help - BlackEvils - 27.05.2015

Quote:
Originally Posted by bondowocopz
Посмотреть сообщение
Try this code, missing brackets.
Код:
if(strcmp("/capture", cmdtext, true, 10) == 0)
{
if(InDm[playerid] >= 1) return SendClientMessage(playerid,0xFF0000FF,"ERROR:You can't use this command in a dm/event.");
if(PlayerInfo[playerid][gangid] == 0) return SendClientMessage(playerid,COLORE_ROSSO,"ERROR:You are not in any gang.");
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1975.5731, -1249.5286, 20.383)//gang 1
{
if(Count <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
Count = 20;
if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang1, 0xFFFFFF96);
if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang1, 0x80000096);
if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
KillTimer(MyTimer[playerid]);
MyTimer[playerid] = SetTimerEx("TestFunction", 1000, 1, "i", playerid);
}
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1104.9656, 992.6399, 30.7290))//gang 2
{
if(Counta <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
Counta = 20;
if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang2, 0xFFFFFF96);
if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang2, 0x80000096);
if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
KillTimer(MyTimera[playerid]);
MyTimera[playerid] = SetTimerEx("TestFunctiona", 1000, 1, "i", playerid);
}
return 1;
}
And you forgot to add ")" on :
Код:
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1975.5731, -1249.5286, 20.383)//gang 1
C:\Users\DAVIDE\Desktop\ise\gamemodes\dm.pwn(5524) : warning 217: loose indentation
C:\Users\DAVIDE\Desktop\ise\gamemodes\dm.pwn(5529) : error 001: expected token: ")", but found "{"
C:\Users\DAVIDE\Desktop\ise\gamemodes\dm.pwn(5552) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Re: Help - Sew_Sumi - 27.05.2015

You've missed another ) somewhere on the line mentioned, or the one prior.

Clean up those indentation errors as well, and you'll probably see it better.


Re: Help - X337 - 27.05.2015

Quote:
Originally Posted by BlackEvils
Посмотреть сообщение
C:\Users\DAVIDE\Desktop\ise\gamemodes\dm.pwn(5524) : warning 217: loose indentation
C:\Users\DAVIDE\Desktop\ise\gamemodes\dm.pwn(5529) : error 001: expected token: ")", but found "{"
C:\Users\DAVIDE\Desktop\ise\gamemodes\dm.pwn(5552) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Fixed ")" with better indentation.
Код:
if(strcmp("/capture", cmdtext, true, 10) == 0)
{
	if(InDm[playerid] >= 1) return SendClientMessage(playerid,0xFF0000FF,"ERROR:You can't use this command in a dm/event.");
	if(PlayerInfo[playerid][gangid] == 0) return SendClientMessage(playerid,COLORE_ROSSO,"ERROR:You are not in any gang.");
	if(IsPlayerInRangeOfPoint(playerid, 10.0, 1975.5731, -1249.5286, 20.383))//gang 1
	{
		if(Count <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
		Count = 20;
		if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang1, 0xFFFFFF96);
		if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
		if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang1, 0x80000096);
		if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
		KillTimer(MyTimer[playerid]);
		MyTimer[playerid] = SetTimerEx("TestFunction", 1000, 1, "i", playerid);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10.0, 1104.9656, 992.6399, 30.7290))//gang 2
	{
		if(Counta <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
		Counta = 20;
		if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang2, 0xFFFFFF96);
		if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
		if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang2, 0x80000096);
		if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
		KillTimer(MyTimera[playerid]);
		MyTimera[playerid] = SetTimerEx("TestFunctiona", 1000, 1, "i", playerid);
	}
	return 1;
}



Re: Help - BlackEvils - 27.05.2015

Quote:
Originally Posted by bondowocopz
Посмотреть сообщение
Fixed ")" with better indentation.
Код:
if(strcmp("/capture", cmdtext, true, 10) == 0)
{
	if(InDm[playerid] >= 1) return SendClientMessage(playerid,0xFF0000FF,"ERROR:You can't use this command in a dm/event.");
	if(PlayerInfo[playerid][gangid] == 0) return SendClientMessage(playerid,COLORE_ROSSO,"ERROR:You are not in any gang.");
	if(IsPlayerInRangeOfPoint(playerid, 10.0, 1975.5731, -1249.5286, 20.383))//gang 1
	{
		if(Count <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
		Count = 20;
		if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang1, 0xFFFFFF96);
		if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
		if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang1, 0x80000096);
		if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
		KillTimer(MyTimer[playerid]);
		MyTimer[playerid] = SetTimerEx("TestFunction", 1000, 1, "i", playerid);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10.0, 1104.9656, 992.6399, 30.7290))//gang 2
	{
		if(Counta <= 19) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:This gang is already under capture.");
		Counta = 20;
		if(PlayerInfo[playerid][gangid] == 1)GangZoneFlashForAll(gang2, 0xFFFFFF96);
		if(PlayerInfo[playerid][gangid] == 1)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
		if(PlayerInfo[playerid][gangid] == 2)GangZoneFlashForAll(gang2, 0x80000096);
		if(PlayerInfo[playerid][gangid] == 2)SendClientMessage(playerid, COLORE_VERDE, "INFO:Capture started wait 20 seconds for capture this territory.");
		KillTimer(MyTimera[playerid]);
		MyTimera[playerid] = SetTimerEx("TestFunctiona", 1000, 1, "i", playerid);
	}
	return 1;
}
thx you !