SA-MP Forums Archive
I will kill myself... - 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: I will kill myself... (/showthread.php?tid=73564)



I will kill myself... - T.I. - 16.04.2009

Код:
C:\Documents and Settings\Customer\Desktop\My scripts\Gamemode.pwn(712) : warning 225: unreachable code
Line 708-717
Код:
if(gTeam[playerid] == TEAM_ADMINISTRATORS && ( !IsPlayerAdmin(playerid) && !IsPlayerAdmin(playerid) ) ) {
 	ForceClassSelection(playerid);
	return SetPlayerHealth(playerid, 0.0);
	
  712)	if(team == TEAM_BALLAS) //0, 1, 2
	{
		SetPlayerColor(playerid,COLOR_TEAM_BALLAS);
		SetPlayerFacingAngle(playerid,270.0);
		SetPlayerInterior(playerid,5);
	}
Please help me with my script!
Thanks!


Re: I will kill myself... - Weirdosport - 16.04.2009

It's because you have an if after a return. It means it's unreachable.. return basically says job done, and everything below it is ignored.

EDIT: I don't think the topic title is very funny..


Re: I will kill myself... - Sandra18[NL] - 16.04.2009

Код:
if((gTeam[playerid] == TEAM_ADMINISTRATORS) && (!IsPlayerAdmin(playerid)) 
{
  ForceClassSelection(playerid);
  return SetPlayerHealth(playerid, 0.0);
}
if(team == TEAM_BALLAS) //0, 1, 2
{
  SetPlayerColor(playerid,COLOR_TEAM_BALLAS);
  SetPlayerFacingAngle(playerid,270.0);
  SetPlayerInterior(playerid,5);
}
That's why you should indent your code. Now you didn't see you were missing a bracket.


Re: I will kill myself... - Finn - 16.04.2009

Quote:
Originally Posted by T.I.
&& ( !IsPlayerAdmin(playerid) && !IsPlayerAdmin(playerid) ) )
Can I ask what the **** is the meaning of this?

Quote:
Originally Posted by T.I.
if(team == TEAM_BALLAS)
team should be gTeam[playerid]?

pawn Код:
if(gTeam[playerid] == TEAM_ADMINISTRATORS && !IsPlayerAdmin(playerid))
{
    ForceClassSelection(playerid);
    return SetPlayerHealth(playerid, 0.0);
}
else if(gTeam[playerid]== TEAM_BALLAS) //0, 1, 2
{
    SetPlayerColor(playerid,COLOR_TEAM_BALLAS);
    SetPlayerFacingAngle(playerid,270.0);
    SetPlayerInterior(playerid,5);
}



Re: I will kill myself... - Weirdosport - 16.04.2009

These solutions should work for you, but if you actually read the error message yourself, you'd see it was pretty clear cut.


Re: I will kill myself... - T.I. - 16.04.2009

No solution helped me...
That solution with bracket bring more errors...

Now I added something new and appears this:
Код:
C:\Documents and Settings\Customer\Desktop\My scripts\Gamemode.pwn(726) : warning 225: unreachable code
C:\Documents and Settings\Customer\Desktop\My scripts\Gamemode.pwn(930) : error 017: undefined symbol "PropertyExists"
C:\Documents and Settings\Customer\Desktop\My scripts\Gamemode.pwn(931) : error 017: undefined symbol "PropertyGet"
C:\Documents and Settings\Customer\Desktop\My scripts\Gamemode.pwn(1107) : error 017: undefined symbol "PropertyExists"
C:\Documents and Settings\Customer\Desktop\My scripts\Gamemode.pwn(1108) : error 017: undefined symbol "PropertyGet"
Код:
new string[256], mute;
	format(string,sizeof(string),"muted.%d",playerid);
  930	if(PropertyExists(string)) {
  931	  mute = strval(PropertyGet(string));
	  if(mute == 1) {
			return 0;
		}
	}
	if(text[0] == '@') {
		TeamChat(playerid, text);
		return 0;
	}
And:

Код:
stock IsAdmin(playerid)
{
	new xplayerid[20], level;
	format(xplayerid,20,"player=%d.level",playerid);

	if(PropertyExists(xplayerid)) {
	  level = strval(PropertyGet(xplayerid));

	  if(IsPlayerAdmin(playerid)) { level = 6; }
	  if(level > 2) {
			return level;
		}
	}
	return 0;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
stock IsMuted(playerid)
{
	new string[20], mute;
	format(string,sizeof(string),"muted.%d",playerid);
	if(PropertyExists(string)) {
	  mute = strval(PropertyGet(string));
	  if(mute == 1) {
			return 1;
		}
	}
	return 0;
}
What to do?
And about Finn ask, I copied that from LethaL script which interdict the usual players to join the Administrator team.

EDIT: Should I add something like that:
Код:
new teamColors[MAX_TEAMS] = {
  COLOR_TEAM_GROVE,
  COLOR_TEAM_COPS,
  COLOR_TEAM_BALLAS,
  COLOR_TEAM_VAGOS,
  COLOR_TEAM_AZTECAS,
  COLOR_TEAM_BIKERS,
  COLOR_TEAM_ARMY,
  COLOR_TEAM_RAPPERS,
  COLOR_TEAM_CLUCKIN,
  COLOR_TEAM_DEALERS,
  COLOR_TEAM_ADMINONLY
};
new teamName[MAX_TEAMS][32] = {
  "Grove Families",
  "Cops",
  "Ballas",
  "Vagos",
  "Aztecas",
  "Bikers",
  "Army",
  "Rappers",
  "Chickens",
  "Drug Dealers",
  "Admins"
};



Re: I will kill myself... - Weirdosport - 16.04.2009

Most of the errors you're getting are because you don't have the custom functions you're trying to use.

Copying chunks of code from other filterscripts is bound to cause you problems.


Re: I will kill myself... - T.I. - 16.04.2009

I just copied that code because I didn't know how to make a team restricted...
But btw, that code which Finn mentioned hasn't errors, just the codes under it.

OK just tell me what to write at the PropertyGet and PropertyExists to make is defined.
And btw, tell me too how to make a team restricted, which can just for admins...