I need help with spawning
#1

So i am trying to make a CnR GameMode and i am trying to make cop,civil,and army classes and random spawns for civils and when you are on the skin selection the skins don't show and they are mixed up with army and cop skins..

Can anyone help me fix the script? Most importantly the skin selection..

Please?
Reply
#2

Without the code..we cant help you...
Reply
#3

Код:
#define Cops 0
#define Army 1
#define Civil 2
#define SerialKiller 3
Код:
AddPlayerClass(287,-1315.9380,437.7021,7.1875,4.0838,0,0,0,0,0,0); // army
AddPlayerClass(283,-1596.3175,733.3856,-4.9063,4.0007,0,0,0,0,0,0); // Cop
//Civil
AddPlayerClass(1, -2719.8279,-318.5510,7.8438, 45.3150,0,0,0,0,0,0);
AddPlayerClass(2,-2742.4075,375.8751,4.3652,89.4049,0,0,0,0,0,0);
AddPlayerClass(3,-2630.1689,599.0845,14.4531,178.8243,0,0,0,0,0,0);
AddPlayerClass(33,-2630.1689,599.0845,14.4531,178.8243,0,0,0,0,0,0);
AddPlayerClass(4,-1985.4353,138.6892,27.6875,83.1007,0,0,0,0,0,0);
AddPlayerClass(5,-1547.2014,676.1210,7.1875,87.3474,0,0,0,0,0,0);
Код:
public OnPlayerRequestClass(playerid, classid)
{
	switch(classid)
	{
	    case 0:
	    {
			gTeam[playerid] = Cops;
            GameTextForPlayer(playerid, "~b~Cop", 5000, 5);
    		SetPlayerPos(playerid,283, -2860.4360, -342.8072, 14.2333);
    		SetPlayerFacingAngle(playerid,87.1632);
    		SetPlayerCameraPos(playerid, -2852.8296, -343.4230, 14.5014);
    		SetPlayerCameraLookAt(playerid, -2860.4360, -342.8072, 14.2333);
	    }
	    	case 1:
	    	{
	        	gTeam[playerid] = Army;
            	GameTextForPlayer(playerid, "~g~Army", 5000, 5);
    			SetPlayerPos(playerid,287, -2860.4360, -342.8072, 14.2333);
    			SetPlayerFacingAngle(playerid,87.1632);
    			SetPlayerCameraPos(playerid, -2852.8296, -343.4230, 14.5014);
    			SetPlayerCameraLookAt(playerid, -2860.4360, -342.8072, 14.2333);
	    	}
	    		case 2:
	    		{
	        		gTeam[playerid] = Civil;
            		GameTextForPlayer(playerid, "~w~Civil", 5000, 5);
    				SetPlayerPos(playerid, -2860.4360, -342.8072, 14.2333);
    				SetPlayerFacingAngle(playerid,87.1632);
    				SetPlayerCameraPos(playerid, -2852.8296, -343.4230, 14.5014);
    				SetPlayerCameraLookAt(playerid, -2860.4360, -342.8072, 14.2333);
	    
	    		}
					case 3:
					{
					    gTeam[playerid] = SerialKiller;
            			GameTextForPlayer(playerid, "~r~Serial Killer", 5000, 5);
    					SetPlayerPos(playerid,33, -2860.4360, -342.8072, 14.2333);
    					SetPlayerFacingAngle(playerid,87.1632);
    					SetPlayerCameraPos(playerid, -2852.8296, -343.4230, 14.5014);
    					SetPlayerCameraLookAt(playerid, -2860.4360, -342.8072, 14.2333);

					}
	}
	return 1;
}
Код:
forward SetPlayerToTeamColour(playerid);
public SetPlayerToTeamColour(playerid)
{
    if(gTeam[playerid] == Cops)
    {
    	SetPlayerColor(playerid, COLOR_BLUE);
    }
	else if(gTeam[playerid] == Army)
    {
    	SetPlayerColor(playerid, COLOR_PURPLE);
    }
    else if(gTeam[playerid] == Civil)
    {
    	SetPlayerColor(playerid, COLOR_WHITE);
    }
    else if(gTeam[playerid] == SerialKiller)
    {
    	SetPlayerColor(playerid, COLOR_PINK);
    }

}
Код:
public OnPlayerSpawn(playerid)
{
	if(gTeam[playerid] == Cops)
	{
		GivePlayerWeapon(playerid, 3, 500);
		GivePlayerWeapon(playerid, 22, 500);
		GivePlayerWeapon(playerid, 25, 500);
		GivePlayerWeapon(playerid, 17, 10);
	}
	if(gTeam[playerid] == Army && (GetPlayerScore(playerid) <= 1700))return SendClientMessage(playerid, COLOR_RED, "You Need 1700 Score To Use Army");
	{
		GivePlayerWeapon(playerid, 4, 500);
		GivePlayerWeapon(playerid, 16, 500);
		GivePlayerWeapon(playerid, 24, 500);
		GivePlayerWeapon(playerid, 32, 500);
		GivePlayerWeapon(playerid, 33, 500);
		GivePlayerWeapon(playerid, 26, 500);
		SetPlayerArmour(playerid, 50.0);
	}
	if(gTeam[playerid] == Civil)
	{
	
	}
	if(gTeam[playerid] == SerialKiller && (GetPlayerScore(playerid) <= 1200))return SendClientMessage(playerid, COLOR_RED, "You Need 1200 Score To Use Serial Killer");
	{
		GivePlayerWeapon(playerid, 9, 500);
		GivePlayerWeapon(playerid, 37, 500);
		GivePlayerWeapon(playerid, 33, 500);
		GivePlayerWeapon(playerid, 24, 500);
		SetPlayerArmour(playerid, 100.0);
	}

	return 1;
}
And the players can spawn with army even tho they have 0 score,but 1700 is needed..
Reply
#4

anyone?
Reply
#5

Dude, you know why it happens ? because when you add a skin in "AddPlayerClass" it makes a new case.
So if the Army's the first in AddPlayerClass, he is a case 0. etc..
Reply
#6

can you give me an example code?
Reply
#7

Well, as far as i can see that you have added army class with class id 0 and inside OnPlayerRequestClass, you are setting the player's team to cop at classid 0.

Код:
AddPlayerClass(287,-1315.9380,437.7021,7.1875,4.0838,0,0,0,0,0,0); // army
AddPlayerClass(283,-1596.3175,733.3856,-4.9063,4.0007,0,0,0,0,0,0); // Cop
//Civil
AddPlayerClass(1, -2719.8279,-318.5510,7.8438, 45.3150,0,0,0,0,0,0);
Код:
public OnPlayerRequestClass(playerid, classid)
{
	switch(classid)
	{
	    case 0:
	    {
			gTeam[playerid] = Cops;
            GameTextForPlayer(playerid, "~b~Cop", 5000, 5);
    		SetPlayerPos(playerid,283, -2860.4360, -342.8072, 14.2333);
    		SetPlayerFacingAngle(playerid,87.1632);
    		SetPlayerCameraPos(playerid, -2852.8296, -343.4230, 14.5014);
    		SetPlayerCameraLookAt(playerid, -2860.4360, -342.8072, 14.2333);
	    }
	    	case 1:
	    	{
	        	gTeam[playerid] = Army;
In the case, class id 0 should be army not cop. That's probably the reason why it is mixing up.

And for the 1700 score to be army, it shouldn't be on spawn. Check it under OnPlayerRequestSpawn instead;

Код:
if (GetPlayerScore(playerid) >= 1700)
{
       //Let the player spawn...
}
else
{
       // Send a message that they can't use this class...
       return 0; // return 0 so that they can't spawn after clicking the spawn button.
}
Reply
#8

I fixed the cases on request class and the addplayerclass

and because i have 2 classes that require score how do i make it for both?
Reply
#9

Switch through the player's team under OnPlayerRequestSpawn and check for their score like i posted above.

Example:

PHP код:
public OnPlayerRequestSpawn(playerid)
{
    switch (
gTeam[playerid])
    {
        case 
Army:
        {
            if (
GetPlayerScore(playerid) >= 1700)
            {
                
// Set the spawn info here
            
}
            else
            {
                
// Send a message
                
return 0;
            }
        }
        case 
Cops:
        {
            
// Do the same if this team requires score.
        
}
    }
    return 
1;

Reply
#10

and when the players spawn the give gun get mixed it doesn't give the right guns for the right class...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)