SA-MP Forums Archive
(help) with change team comand - 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: (help) with change team comand (/showthread.php?tid=213665)



(help) with change team comand - Amine_Mejrhirrou - 19.01.2011

hi all i want to make a comand for player to change team only if they have kill 1 persone befor
some thinks like
Код:
if(strcmp(cmd, "/human", true) ==0)
	{
		if(playйr has kill a human)
		{
	        team[playerid] = 1;
                SetPlayerHealth(playerid, 0);
	        SendClientMessage(playerid,GREEN,"you turn to human.");
	
	        return 1;
 		}
		else
 		{
                 SendClientMessage(playerid,GREEN,"you must kill a human to chang your team");
 			return 1;
 		}
	}



Re: (help) with change team comand - WillyP - 19.01.2011

SetPlayerTeam?


Re : (help) with change team comand - Amine_Mejrhirrou - 19.01.2011

nahh !! i mean the player can't use this comand if he don't kill an other player befor


Re: (help) with change team comand - WillyP - 19.01.2011

pawn Код:
public OnPlayerDeath(playerid,killerid,reason)
{
     if(killerid == zombie or w/e you use)
     {
          SetPVarInt("CanChangeTeam",1);
     }
     return 1;
}
Try that, did it quickly.


Re : (help) with change team comand - Amine_Mejrhirrou - 19.01.2011

not workin


Re: (help) with change team comand - Ironboy - 19.01.2011

pawn Код:
if (strcmp("/class", cmdtext, true, 10) == 0)
    {
        ForceClassSelection(playerid);
        SendClientMessage(playerid, 0xAA3333AA,"[CLASS]> You have been forced to the class selection");
        SetPlayerHealth(playerid, 0.00);
        return 1;
        }
try this..


Re : Re: (help) with change team comand - Amine_Mejrhirrou - 19.01.2011

Quote:
Originally Posted by Ironboy
Посмотреть сообщение
pawn Код:
if (strcmp("/class", cmdtext, true, 10) == 0)
    {
        ForceClassSelection(playerid);
        SendClientMessage(playerid, 0xAA3333AA,"[CLASS]> You have been forced to the class selection");
        SetPlayerHealth(playerid, 0.00);
        return 1;
        }
try this..
man that's for sйlйction class ... i never talk about going to class selection ... i wan't to change player team if the payer kill other players


Re: (help) with change team comand - Ironboy - 19.01.2011

mmmm..... i think class selection


Re: (help) with change team comand - Macluawn - 19.01.2011

use a global variable to store if players has killed a human or hasn't. set it to 1 in onplayerdeath.
On top of your script add new killedAHuman[MAX_PLAYERS];.
in OnPlayerDeath add killedAHuman[killerid] = true;
and finally in the cmd do a check if(killedAHuman == true)....else


Re : (help) with change team comand - Amine_Mejrhirrou - 19.01.2011

ok so is this corйct
Код:
new killedAHuman[MAX_PLAYERS];
OnPlayerDeath

Код:
if(infected[playerid] > 0 || team[killerid] == 2)
	{
		GetPlayerName(playerid, player,sizeof(player));
		GetPlayerName(killerid, killer,sizeof(killer));
		format(string,sizeof(string), "%s has been turned into a zombie by %s(zombie)", player, killer);
		killedAHuman[killerid] = true;
	}
the cmd

Код:
	if(strcmp(cmd, "/human", true) ==0)
	{
	    if(team[playerid] == 2) return SendClientMessage(playerid, YELLOW, "you must be human");
	    if(killedAHuman == true)
	    {
	        team[playerid] = 1;
	        SendClientMessage(playerid,GREEN,"you turn to a human.");
	        return 1;
 		}
		else
 		{
			SendClientMessage(playerid,GREEN,"you turn to a human.");
 			return 1;
 		}
	}