SA-MP Forums Archive
No Error But in the Game - 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)
+--- Thread: No Error But in the Game (/showthread.php?tid=337061)



No Error But in the Game - [D]ry[D]esert - 24.04.2012

hello guys i want make Random zombie when map changed
PHP код:
forward RandZombie();
public 
RandZombie()
{
    new 
Players2[MAX_PLAYERS], k;
    new 
count 0;
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) && gTeam[i] == TEAM_HUMANSPlayers2[k++] = i;
        {
            
count++;
        }
    }

and add
PHP код:
RandZombie(); 
anywhere
This Show No Error But when i run this on my server


Uploaded with ImageShack.us

any help please ?
Sorry for my bad english


Re: No Error But in the Game - BleverCastard - 24.04.2012

You have no AddPlayerClass under OnGamemodeInit.


Re: No Error But in the Game - Face9000 - 24.04.2012

Add AddPlayerClass on OnGameModeInit,maybe you forgot it.


Re: No Error But in the Game - [D]ry[D]esert - 25.04.2012

Nah but when i remove Randzombie It Work Probelly


Re: No Error But in the Game - Azazelo - 25.04.2012

and RETURN 1; and end of public


Re: No Error But in the Game - $$inSane - 25.04.2012

try zombie mod in the gamemode section


Re: No Error But in the Game - MP2 - 25.04.2012

What are you actually trying to achieve?

pawn Код:
if(IsPlayerConnected(i) && gTeam[i] == TEAM_HUMANS) Players2[k++] = i;
        {
            count++;
        }
Looks strange. Not sure you should have a statement like that (Players2) on the end of an if() line then open brackets with code inside that. Shouldn't the Players2 line be inside the brackets..?


Re: No Error But in the Game - mincer1667 - 25.04.2012

that should work for random:

Код:
public RandZombie()
{
    new Players2[MAX_PLAYERS], k;
    new count = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && gTeam[i] == TEAM_HUMANS) Players2[k++] = i;
        {
            count++;
        }
        if (count == 0) return 1;
        else
	{
		new RandomPlayer = Players[random(k)];
		gTeam[RandomPlayer] = TEAM_ZOMBIES;
		SendClientMessage(RandomPlayer, -1, "Random Zombie");
	}
    }
    return 1;
}



Re: No Error But in the Game - [D]ry[D]esert - 25.04.2012

Quote:
Originally Posted by mincer1667
Посмотреть сообщение
that should work for random:

Код:
public RandZombie()
{
    new Players2[MAX_PLAYERS], k;
    new count = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && gTeam[i] == TEAM_HUMANS) Players2[k++] = i;
        {
            count++;
        }
        if (count == 0) return 1;
        else
	{
	201 >>> new RandomPlayer = Players[random(k)];
		gTeam[RandomPlayer] = TEAM_ZOMBIES;
		SendClientMessage(RandomPlayer, -1, "Random Zombie");
	}
    }
    return 1;
}
C:\Users\almooo\Desktop\Zombie server\gamemodes\Zm.pwn(201) : error 028: invalid subscript (not an array or too many subscripts): "Players"
C:\Users\almooo\Desktop\Zombie server\gamemodes\Zm.pwn(201) : error 001: expected token: ";", but found "]"
C:\Users\almooo\Desktop\Zombie server\gamemodes\Zm.pwn(201) : error 029: invalid expression, assumed zero
C:\Users\almooo\Desktop\Zombie server\gamemodes\Zm.pwn(201) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.


Re: No Error But in the Game - mincer1667 - 25.04.2012

oh my bad change it to
Код:
RandomPlayer = Players2[random(k)];