SA-MP Forums Archive
Ummhhh - 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: Ummhhh (/showthread.php?tid=199761)



Ummhhh - WardenCS - 16.12.2010

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



Re: Ummhhh - WardenCS - 16.12.2010

up.....


Re: Ummhhh - Baboon - 16.12.2010

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


Re: Ummhhh - WardenCS - 17.12.2010

up.....


Re: Ummhhh - WillyP - 17.12.2010

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



Re: Ummhhh - WardenCS - 18.12.2010

aint working


Re: Ummhhh - WardenCS - 18.12.2010

upssssssssssssssssssssssssss


Re: Ummhhh - rs.pect - 18.12.2010

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