Little Problem
#1

Hi Guys, I have a little problem and i tried to fix it many times but i failed. i tried with all my skills but i can't.
Anyway, Here is the error and the line.
but remember i'm trying to to make infecting system not works when player the player is zombie too but it detects the player by his victim color
Here is the lines :
Код:
error 017: undefined symbol "victimid"
Line
Код:
 if(GetPlayerColor(victimid) == COLOR_ZOMBIE)
I hope you to help me guys :/ thank you for reading
Reply
#2

Did you use SSCANF to define victimid?
Reply
#3

yes but not sscanf2.
Reply
#4

Show us the whole code.
Reply
#5

okay
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
    if(newkeys & KEY_WALK) {
        if(GetPlayerSkin(playerid) == 230)
        {
        	ApplyAnimation(playerid, "WAYFARER", "WF_hit", 3.0, 0, 0, 0, 0, 0),PlayerPlaySound(playerid, 1169, 0.0, 0.0, 0.0);
        	new victimid = GetClosestPlayer(playerid);
        	if(GetDistanceBetweenPlayers(playerid,victimid) < 1) {
	         	Infected[playerid]=1;
	    		GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~5",1000,1);
	      		SetPlayerDrunkLevel(victimid,3000);
				return 1;
		    }
		}
        if(GetPlayerColor(victimid) == COLOR_ZOMBIE)
        {
        	   ApplyAnimation(playerid, "WAYFARER", "WF_hit", 3.0, 0, 0, 0, 0, 0),PlayerPlaySound(playerid, 1169, 0.0, 0.0, 0.0);
        	   new victimid = GetClosestPlayer(playerid);
        	   if(GetDistanceBetweenPlayers(playerid,victimid) < 1) {
       	       Infected[playerid]=0;
            }
			   return 1;
               }
        return 1;
        }
    return 1;
}
Reply
#6

Try this.

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys) {
    new 
victimid GetClosestPlayer(playerid);
    if(
newkeys KEY_WALK) {
        if(
GetPlayerSkin(playerid) == 230)
        {
            
ApplyAnimation(playerid"WAYFARER""WF_hit"3.000000),PlayerPlaySound(playerid11690.00.00.0);
            if(
GetDistanceBetweenPlayers(playerid,victimid) < 1) {
                 
Infected[playerid]=1;
                
GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~5",1000,1);
                  
SetPlayerDrunkLevel(victimid,3000);
                return 
1;
            }
        }
        if(
GetPlayerColor(victimid) == COLOR_ZOMBIE)
        {
               
ApplyAnimation(playerid"WAYFARER""WF_hit"3.000000),PlayerPlaySound(playerid11690.00.00.0);
               new 
victimid GetClosestPlayer(playerid);
               if(
GetDistanceBetweenPlayers(playerid,victimid) < 1) {
                  
Infected[playerid]=0;
            }
               return 
1;
               }
        return 
1;
        }
    return 
1;

Reply
#7

now i found this warning
Код:
C:\Users\infogenie\Documents\Downloads\Compressed\samp037_svr_R2-1-1_win32_4\gamemodes\inf.pwn(746) : warning 219: local variable "victimid" shadows a variable at a preceding level
Reply
#8

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys) {
    new 
victimid GetClosestPlayer(playerid);
    if(
newkeys KEY_WALK) {
        if(
GetPlayerSkin(playerid) == 230)
        {
            
ApplyAnimation(playerid"WAYFARER""WF_hit"3.000000),PlayerPlaySound(playerid11690.00.00.0);
            if(
GetDistanceBetweenPlayers(playerid,victimid) < 1) {
                 
Infected[playerid]=1;
                
GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~5",1000,1);
                  
SetPlayerDrunkLevel(victimid,3000);
                return 
1;
            }
        }
        if(
GetPlayerColor(victimid) == COLOR_ZOMBIE)
        {
               
ApplyAnimation(playerid"WAYFARER""WF_hit"3.000000),PlayerPlaySound(playerid11690.00.00.0);
               if(
GetDistanceBetweenPlayers(playerid,victimid) < 1) {
                  
Infected[playerid]=0;
            }
               return 
1;
               }
        return 
1;
        }
    return 
1;

Reply
#9

thanks man +REP
Reply
#10

man i tested it with my friend but there is a big problem i infect my self not him
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)