SA-MP Forums Archive
Need help in Gamemode +1Rep - 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: Need help in Gamemode +1Rep (/showthread.php?tid=575291)



Need help in Gamemode MONEY REWARD - Charalambos26 - 25.05.2015

Hello,
I have an CnR Gamemode, and there are many teams, such as the CIA,CIV, Army and Medic teams.
The Problem is that the CIA, CIV, Army and Medic teams are only available if you have an degree which you buyed from the Cityhall.
Now my question is, if somebody can remove this feature so that these 4 Teams are for everyone joinable.

Reward: +1Rep + 8$

Thx,


Re: Need help in Gamemode +1Rep - Ghazal - 25.05.2015

Share us the code?

And yeah by the way I dont think a 24 post guy can give a countable rep.


Re: Need help in Gamemode +1Rep - Charalambos26 - 25.05.2015

Quote:
Originally Posted by Maro06
Посмотреть сообщение
Share us the code?

And yeah by the way I dont think a 24 post guy can give a countable rep.
It's a whole Gamemode, I just search for someone who is interested to fix it


Re: Need help in Gamemode +1Rep - Ghazal - 25.05.2015

Quote:
Originally Posted by Charalambos26
Посмотреть сообщение
It's a whole Gamemode, I just search for someone who is interested to fix it
You only mentioned a thing to fix, show us the code of OnPlayerRequestClass and OnPlayerRequestSpawn.


Re: Need help in Gamemode +1Rep - Charalambos26 - 25.05.2015

Quote:
Originally Posted by Maro06
Посмотреть сообщение
You only mentioned a thing to fix, show us the code of OnPlayerRequestClass and OnPlayerRequestSpawn.
Код HTML:
public OnPlayerRequestClass(playerid, classid)
{
    if(IsPlayerNPC(playerid)) return 1;
    SetPlayerTeamFromClass(playerid, classid);
    SetPlayerPos(playerid, 2116.0205, 2143.3225, 10.8203);
    SetPlayerFacingAngle(playerid, 89.6528);
    SetPlayerCameraLookAt(playerid, 2116.0205, 2143.3225, 10.8203);
    SetPlayerCameraPos(playerid, 2116.0205 + (5 * floatsin(-89.6528, degrees)), 2143.3225 + (5 * floatcos(-89.6528, degrees)), 10.8203);
	return 1;
}

Код HTML:
public OnPlayerRequestSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;

    if(IsLoggedIn{playerid} == 0)
	{
		SendClientMessage(playerid, RED, "You MUST be registered and logged in before you can spawn.") && Kick(playerid);
		return 0;
	}
    else if(GetTeam{playerid} == CLASS_COPS && PlayerInfo[playerid][pWanted] >= 1 || GetPlayerWantedLevel(playerid) >= 1)
    {
		SendClientMessage(playerid, RED, "You cant spawn as Law Enforcement while you have Wanted Level.");
      	ForceClassSelection(playerid);
      	return 0;
    }
    else if(GetTeam{playerid} == CLASS_ARMY)
    {
        if(PlayerInfo[playerid][pWanted] < 1 || GetPlayerWantedLevel(playerid) < 1)
        {
			if(DegreeInfo[playerid][dDefense] == 1)
    		{
				return 1;
    		}
    		else
    		{
				SendClientMessage(playerid, RED, "This command is restricted to Defense Degree.");
      			GameTextForPlayer(playerid,"~r~Restricted Class", 3000, 5);
      			ForceClassSelection(playerid);
      			return 0;
    		}
    	}
    	else
    	{
			SendClientMessage(playerid, RED, "You cant spawn as Law Enforcement while you have Wanted Level.");
      		ForceClassSelection(playerid);
    	}
      	return 0;
    }
    else if(GetTeam{playerid} == CLASS_CIA || GetTeam{playerid} == CLASS_FBI)
    {
        if(PlayerInfo[playerid][pWanted] < 1 || GetPlayerWantedLevel(playerid) < 1)
        {
			if(DegreeInfo[playerid][dLaw] == 1)
    		{
				return 1;
    		}
    		else
    		{
				SendClientMessage(playerid, RED, "This command is restricted to Law Degree.");
      			GameTextForPlayer(playerid,"~r~Restricted Class", 3000, 5);
      			ForceClassSelection(playerid);
      			return 0;
    		}
    	}
    	else
    	{
			SendClientMessage(playerid, RED, "You cant spawn as Law Enforcement while you have Wanted Level.");
      		ForceClassSelection(playerid);
    	}
      	return 0;
    }
    else if(GetTeam{playerid} == CLASS_MEDIC)
    {
        if(PlayerInfo[playerid][pWanted] < 1 || GetPlayerWantedLevel(playerid) < 1)
        {
			if(DegreeInfo[playerid][dHealth] == 1)
    		{
				return 1;
    		}
    		else
    		{
				SendClientMessage(playerid, RED, "This command is restricted to Medical Degree.");
      			GameTextForPlayer(playerid,"~r~Restricted Class", 3000, 5);
      			ForceClassSelection(playerid);
      			return 0;
    		}
    	}
    	else
    	{
			SendClientMessage(playerid, RED, "You cant spawn as a Medic while you have Wanted Level.");
      		ForceClassSelection(playerid);
    	}
      	return 0;
    }
    return 1;
}



Re: Need help in Gamemode +1Rep - Ghazal - 25.05.2015

Quote:
Originally Posted by Charalambos26
Посмотреть сообщение
Код HTML:
public OnPlayerRequestClass(playerid, classid)
{
    if(IsPlayerNPC(playerid)) return 1;
    SetPlayerTeamFromClass(playerid, classid);
    SetPlayerPos(playerid, 2116.0205, 2143.3225, 10.8203);
    SetPlayerFacingAngle(playerid, 89.6528);
    SetPlayerCameraLookAt(playerid, 2116.0205, 2143.3225, 10.8203);
    SetPlayerCameraPos(playerid, 2116.0205 + (5 * floatsin(-89.6528, degrees)), 2143.3225 + (5 * floatcos(-89.6528, degrees)), 10.8203);
	return 1;
}

Код HTML:
public OnPlayerRequestSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;

    if(IsLoggedIn{playerid} == 0)
	{
		SendClientMessage(playerid, RED, "You MUST be registered and logged in before you can spawn.") && Kick(playerid);
		return 0;
	}
    else if(GetTeam{playerid} == CLASS_COPS && PlayerInfo[playerid][pWanted] >= 1 || GetPlayerWantedLevel(playerid) >= 1)
    {
		SendClientMessage(playerid, RED, "You cant spawn as Law Enforcement while you have Wanted Level.");
      	ForceClassSelection(playerid);
      	return 0;
    }
    else if(GetTeam{playerid} == CLASS_ARMY)
    {
        if(PlayerInfo[playerid][pWanted] < 1 || GetPlayerWantedLevel(playerid) < 1)
        {
			if(DegreeInfo[playerid][dDefense] == 1)
    		{
				return 1;
    		}
    		else
    		{
				SendClientMessage(playerid, RED, "This command is restricted to Defense Degree.");
      			GameTextForPlayer(playerid,"~r~Restricted Class", 3000, 5);
      			ForceClassSelection(playerid);
      			return 0;
    		}
    	}
    	else
    	{
			SendClientMessage(playerid, RED, "You cant spawn as Law Enforcement while you have Wanted Level.");
      		ForceClassSelection(playerid);
    	}
      	return 0;
    }
    else if(GetTeam{playerid} == CLASS_CIA || GetTeam{playerid} == CLASS_FBI)
    {
        if(PlayerInfo[playerid][pWanted] < 1 || GetPlayerWantedLevel(playerid) < 1)
        {
			if(DegreeInfo[playerid][dLaw] == 1)
    		{
				return 1;
    		}
    		else
    		{
				SendClientMessage(playerid, RED, "This command is restricted to Law Degree.");
      			GameTextForPlayer(playerid,"~r~Restricted Class", 3000, 5);
      			ForceClassSelection(playerid);
      			return 0;
    		}
    	}
    	else
    	{
			SendClientMessage(playerid, RED, "You cant spawn as Law Enforcement while you have Wanted Level.");
      		ForceClassSelection(playerid);
    	}
      	return 0;
    }
    else if(GetTeam{playerid} == CLASS_MEDIC)
    {
        if(PlayerInfo[playerid][pWanted] < 1 || GetPlayerWantedLevel(playerid) < 1)
        {
			if(DegreeInfo[playerid][dHealth] == 1)
    		{
				return 1;
    		}
    		else
    		{
				SendClientMessage(playerid, RED, "This command is restricted to Medical Degree.");
      			GameTextForPlayer(playerid,"~r~Restricted Class", 3000, 5);
      			ForceClassSelection(playerid);
      			return 0;
    		}
    	}
    	else
    	{
			SendClientMessage(playerid, RED, "You cant spawn as a Medic while you have Wanted Level.");
      		ForceClassSelection(playerid);
    	}
      	return 0;
    }
    return 1;
}
Try
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;

    if(IsLoggedIn{playerid} == 0)
    {
        SendClientMessage(playerid, RED, "You MUST be registered and logged in before you can spawn.") && Kick(playerid);
        return 0;
    }
    else if(GetTeam{playerid} == CLASS_COPS && PlayerInfo[playerid][pWanted] >= 1 || GetPlayerWantedLevel(playerid) >= 1)
    {
        SendClientMessage(playerid, RED, "You cant spawn as Law Enforcement while you have Wanted Level.");
        ForceClassSelection(playerid);
        return 0;
    }
    else if(GetTeam{playerid} == CLASS_ARMY)
    {
        if(PlayerInfo[playerid][pWanted] < 1 || GetPlayerWantedLevel(playerid) < 1)
        {
            return 1;
        }
        else
        {
            SendClientMessage(playerid, RED, "You cant spawn as Law Enforcement while you have Wanted Level.");
            ForceClassSelection(playerid);
        }
        return 0;
    }
    else if(GetTeam{playerid} == CLASS_CIA || GetTeam{playerid} == CLASS_FBI)
    {
        if(PlayerInfo[playerid][pWanted] < 1 || GetPlayerWantedLevel(playerid) < 1)
        {
            return 1;
        }
        else
        {
            SendClientMessage(playerid, RED, "You cant spawn as Law Enforcement while you have Wanted Level.");
            ForceClassSelection(playerid);
        }
        return 0;
    }
    else if(GetTeam{playerid} == CLASS_MEDIC)
    {
        if(PlayerInfo[playerid][pWanted] < 1 || GetPlayerWantedLevel(playerid) < 1)
        {
            return 1;
        }
        else
        {
            SendClientMessage(playerid, RED, "You cant spawn as a Medic while you have Wanted Level.");
            ForceClassSelection(playerid);
        }
        return 0;
    }
    return 1;
}