Infect help!!!
#1

I have this code for infecting human player when a certain class of zombie presses LALT. I don't know why but this code is not working . Can Someone Please help.....
Код:
if(PRESSED(KEY_WALK))
	{
	    if(team[playerid] == TEAM_ZOMBIE)
	    {
			if(pInfo[playerid][pZombieClass] == MUTATEDZOMBIE)
			{
                if(gettime() - 10 < Abilitys[playerid][AdvancedMutatedCooldown]) return GameTextForPlayer(playerid,"~w~ Still recovering",1000,5);
			    {
					foreach(Player,i)
					{
      					switch(GetPlayerSkin(i))
						{
       						case NON_IMMUNE,70:
							{
                        	    if(GetDistanceBetweenPlayers(playerid,i) < 6.5)
                        	    {
							    	if(pInfo[i][IsPlayerInfected] == 0)
							    	{
										InfectPlayerStandard(i);
										GivePlayerXP(playerid,10);
										GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~y~+10 XP",3500,5);
										Abilitys[playerid][AdvancedMutatedCooldown] = gettime();
									}
								}
							}
						}
					}
				}
			}
		}
	}
Reply
#2

Код:
if(PRESSED(KEY_WALK))
	{
	    if(team[playerid] == TEAM_ZOMBIE)
	    {
			if(pInfo[playerid][pZombieClass] == MUTATEDZOMBIE)
			{
                if(gettime() - 10 < Abilitys[playerid][AdvancedMutatedCooldown]) return GameTextForPlayer(playerid,"~w~ Still recovering",1000,5);
                else
			    {
					foreach(Player,i)
					{
      					switch(GetPlayerSkin(i))
						{
       						case NON_IMMUNE,70:
							{
                        	    if(GetDistanceBetweenPlayers(playerid,i) < 6.5)
                        	    {
							    	if(pInfo[i][IsPlayerInfected] == 0)
							    	{
										InfectPlayerStandard(i);
										GivePlayerXP(playerid,10);
										GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~y~+10 XP",3500,5);
										Abilitys[playerid][AdvancedMutatedCooldown] = gettime();
									}
								}
							}
						}
					}
				}
			}
		}
	}
Reply
#3

ohhhh.. Thank you. I forgot to put that "else". I will just try the code.
EDIT: Nah its not working....
Reply
#4

Код:
if(PRESSED(KEY_WALK))
	{
	    if(team[playerid] == TEAM_ZOMBIE)
	    {
			if(pInfo[playerid][pZombieClass] == MUTATEDZOMBIE)
			{
                if(gettime() - 10 < Abilitys[playerid][AdvancedMutatedCooldown]) return GameTextForPlayer(playerid,"~w~ Still recovering",1000,5);
	            }
				else
			    {
					foreach(Player,i)
					{
      					switch(GetPlayerSkin(i))
						{
       						case NON_IMMUNE,70:
							{
                        	    if(GetDistanceBetweenPlayers(playerid,i) < 6.5)
                        	    {
							    	if(pInfo[i][IsPlayerInfected] == 0)
							    	{
										InfectPlayerStandard(i);
										GivePlayerXP(playerid,10);
										GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~y~+10 XP",3500,5);
										Abilitys[playerid][AdvancedMutatedCooldown] = gettime();
									}
								}
							}
						}
					}
				}
			}
		}
I think he had forgotten something, try now...
Reply
#5

No It doesn't work either....
Reply
#6

This is not how to use Scripting Help people.


How do you get PRESSED?
Reply
#7

Of course I had put the if case in this one
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
Reply
#8

This is the problem. Unless you are using that callback properly, no changes anywhere else will do anything.

You'll wanna paste up the section of code that defines PRESSED in OnPlayerKeyStateChange.

If you look around on faults with that callback, the most common is using simply "newkeys", and not both of them.

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

Look carefully in the section regarding "How NOT to check for a key" and below that.


Still though, paste up your OnPlayerKeyStateChange if you are still stumped.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)