Stopping a player spawn if they don't meet requirement
#1

Hey, I've basically got a PlayerInfo[playerid][Clan] system, So for example, Clan = 1, Able to spawn as PD.

How would I implament it if I was set to clan 0, went to choose PD and not allowed to spawn as I am not in Clan 1?

Код:
		if(PlayerInfo[playerid][Clan] != 1)
		{
			return 0;
		}
I basically have this, Do I place it under public OnPlayerRequestClass pr OnPlayerSpawn?
Reply
#2

onplayerrequestspawn
Reply
#3

I seem to confuse myself,

Код:
public OnPlayerRequestSpawn(playerid)
{
    if(PlayerInfo[playerid][Clan] != 1)
	{
		return 0;
	}
	return 1;
}
forward SetPlayerTeamFromClass(playerid, classid);
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    {
  		if(classid == 0)
   		{
   			gTeam[playerid] = TEAM_US;
   			SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
        	SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
        	SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
        	SetPlayerFacingAngle(playerid,252.4717);
        	GameTextForPlayer(playerid, "~b~American's", 3000, 5);
        	SetPlayerColor(playerid, BLUE);
   			return 1;
   		}
		else if(classid == 1)
  		{
  			gTeam[playerid] = TEAM_RUS;
  			SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
   			SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
        	SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
        	SetPlayerFacingAngle(playerid,252.4717);
        	GameTextForPlayer(playerid, "~r~Russian's", 3000, 5);
        	SetPlayerColor(playerid, RED);
  			return 1;
		}
	}
    return 1;
}
Trying to stop anyone not in clan 1 spawning as gTeam[playerid] = TEAM_US;
Reply
#4

pawn Код:
forward SetPlayerTeamFromClass(playerid, classid);
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    {
        if(classid == 0 && PlayerInfo[playerid][Clan] == 1)
        {
            gTeam[playerid] = TEAM_US;
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            GameTextForPlayer(playerid, "~b~American's", 3000, 5);
            SetPlayerColor(playerid, BLUE);
            return 1;
        }
        else if(classid == 1)
        {
            gTeam[playerid] = TEAM_RUS;
            SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
            SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
            SetPlayerFacingAngle(playerid,252.4717);
            GameTextForPlayer(playerid, "~r~Russian's", 3000, 5);
            SetPlayerColor(playerid, RED);
            return 1;
        }
    }
    return 1;
}
Reply
#5

I believe it has something to do with "onplayerrequestspawn".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)