Ummhhh
#1

Hey,i want to make a command when ya /infect it will take a player near you,atleast 5 meters and infects him/her,but if theres no person near you it wont infect anyone,but im kinda sleepy and i dont see the problem,heres the command

Код:
	if(strcmp(cmd, "/infect", true) == 0)
	{
		for(new i=0;i<MAX_PLAYERS;i++)
		{
			if(i!=playerid)
			{
				new Float:x,Float:y,Float:z;
				GetPlayerPos(playerid,x,y,z);
				if(PlayerToPoint(1,i,x,y,z) && i!=playerid)
				{
					Inftimer = SetTimerEx("InfectedTimer",5000,true,"i",i);
					SendClientMessage(i,COLOR_RED,"You have been biten,you are now infected,Quickly get some antidote");
					Infected[i] = 1;
					new string[256];
					}
					}
					}
	return 1;
	}
Reply
#2

up.....
Reply
#3

I don't know, also try using string[128] abd it's bitten.
Reply
#4

up.....
Reply
#5

pawn Код:
if(strcmp(cmd, "/infect", true) == 0)
    {
        for(new i=0;i<MAX_PLAYERS;i++)
        {
            if(i!=playerid)
            {
                new name[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                new name2[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name2, sizeof(name2));
                new Float:x,Float:y,Float:z;
                GetPlayerPos(playerid,x,y,z);
                if(PlayerToPoint(1,i,x,y,z))
                {
                    Inftimer = SetTimerEx("InfectedTimer",5000,true,"i",i);
                    SendClientMessage(i,COLOR_RED,"You have been biten,you are now infected,Quickly get some antidote");
                    Infected[i] = 1;
                    new string[128];
                    format(string,sizeof(string),"%s infected %s.",name1,name2);
                    SendClientMessageToAll(YOURCOLOR,string);
                }
            }
        }
    return 1;
}
Reply
#6

aint working
Reply
#7

upssssssssssssssssssssssssss
Reply
#8

pawn Код:
if(strcmp(cmd, "/infect", true) == 0)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    new name2[MAX_PLAYER_NAME];

    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);

    new somebody_is_infected = 0;

    for(new i; i < MAX_PLAYERS; i++) // I would suggest you to use foreach
    {
        if(i != playerid)
        {
            GetPlayerName(i, name2, sizeof(name2));

            if(PlayerToPoint(1,i,x,y,z))
            {
                Inftimer = SetTimerEx("InfectedTimer",5000,true,"i",i);
                SendClientMessage(i,COLOR_RED,"You have been biten,you are now infected,Quickly get some antidote");
                Infected[i] = 1;
                new string[128];
                format(string,sizeof(string),"%s infected %s.",name1,name2);
                SendClientMessageToAll(YOURCOLOR,string);
                somebody_is_infected = 1;
            }
        }
    }

    if(somebody_is_infected == 0)
    {
        //add a message here that nobody has been infected
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)