(help) with change team comand
#1

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;
 		}
	}
Reply
#2

SetPlayerTeam?
Reply
#3

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

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

not workin
Reply
#6

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..
Reply
#7

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
Reply
#8

mmmm..... i think class selection
Reply
#9

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
Reply
#10

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;
 		}
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)