SA-MP Forums Archive
Apply for cop,army or fbi wont 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: Apply for cop,army or fbi wont work (/showthread.php?tid=83750)



Apply for cop,army or fbi wont work - Chrham_2 - 26.06.2009

This is my requestspawn:

Код:
public OnPlayerRequestSpawn(playerid)
{
  new playername[MAX_PLAYER_NAME];
	if(gTeam[playerid]==Team_Cops) // POLICE
	{
	  if(strcmp(playername,"LVC_Chrham2",false)==0)
	  {
	    SendClientMessage(playerid,COLOR_BLUE,"Welcome to you, Police Officer! You are now on duty and you must do your best to protect Chrham's City!");
	    return 1;
	  }
	  else
	  {
	  	SendClientMessage(playerid,COLOR_BLUE,"Only cops who have applied at the forums can spawn.");
	  	SendClientMessage(playerid,COLOR_BLUE,"http://chrhamrpg.one-forum.net/businesses-f6/");
	  	return 0;
		}
	}
	if(gTeam[playerid]==Team_FBI) // FBI
	{
	  if(strcmp(playername,"LVC_Chrham2",false)==0)
	  {
	    SendClientMessage(playerid,COLOR_BLUE,"Welcome to you, FBI Officer! You are now on duty and you must do your best to protect Chrham's City!");
	    return 1;
	  }
	  else
	  {
	  	SendClientMessage(playerid,COLOR_BLUE,"Only FBI Officers who have applied at the forums can spawn.");
	  	SendClientMessage(playerid,COLOR_BLUE,"http://chrhamrpg.one-forum.net/businesses-f6/");
	  	return 0;
		}
	}
	if(gTeam[playerid]==Team_Army) // ARMY
	{
	  if(strcmp(playername,"LVC_Chrham2",false)==0)
	  {
	    SendClientMessage(playerid,COLOR_BLUE,"Welcome to you guy in the army! You must do your best to protect Chrham's City!");
	    return 1;
	  }
	  else
	  {
	  	SendClientMessage(playerid,COLOR_BLUE,"Only armys who have applied at the forums can spawn.");
	  	SendClientMessage(playerid,COLOR_BLUE,"http://chrhamrpg.one-forum.net/businesses-f6/");
	  	return 0;
		}
	} else {
	return 1;
	}
}
Its supposed to lock the skin for evryone but LVC_Chrham2, but it dont work. Can you helep me?


Re: Apply for cop,army or fbi wont work - Grim_ - 27.06.2009

Get the player name, and then try, if I understnad what you're trying to do.


Re: Apply for cop,army or fbi wont work - Chrham_2 - 27.06.2009

Quote:
Originally Posted by Swift_
Get the player name, and then try, if I understnad what you're trying to do.
Huh? Anyways.. Anyone know how to fix it?


Re: Apply for cop,army or fbi wont work - Grim_ - 27.06.2009


You know only people with the name "LVC_Chrham2" can join those teams?


Re: Apply for cop,army or fbi wont work - Chrham_2 - 27.06.2009

Quote:
Originally Posted by Swift_

You know only people with the name "LVC_Chrham2" can join those teams?
yes


Re: Apply for cop,army or fbi wont work - Grim_ - 27.06.2009

Then as i said before, you have to get the players name aswell.
pawn Код:
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);



Re: Apply for cop,army or fbi wont work - Chrham_2 - 27.06.2009

Quote:
Originally Posted by Swift_
Then as i said before, you have to get the players name aswell.
pawn Код:
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
Im not gonna GET the name, im gonna check if the name IS LVC_Chrham2


Re: Apply for cop,army or fbi wont work - Grim_ - 27.06.2009

Quote:
Originally Posted by Chrham_2
Quote:
Originally Posted by Swift_
Then as i said before, you have to get the players name aswell.
pawn Код:
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
Im not gonna GET the name, im gonna check if the name IS LVC_Chrham2
You should really still DO it.

EDIT: right now, the playername variable = 0; Using GetPlayerName you set the variable to the players current name.


Re: Apply for cop,army or fbi wont work - Chrham_2 - 27.06.2009

Quote:
Originally Posted by Swift_
Quote:
Originally Posted by Chrham_2
Quote:
Originally Posted by Swift_
Then as i said before, you have to get the players name aswell.
pawn Код:
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
Im not gonna GET the name, im gonna check if the name IS LVC_Chrham2
You should really still DO it.
Ugh... Well. Can you fix my script then.. I will learn from that to


Re: Apply for cop,army or fbi wont work - Grim_ - 27.06.2009

Add that line right after the
pawn Код:
new playername[MAX_PLAYER_NAME];
variable.