No Error But in the Game
#1

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
Reply
#2

You have no AddPlayerClass under OnGamemodeInit.
Reply
#3

Add AddPlayerClass on OnGameModeInit,maybe you forgot it.
Reply
#4

Nah but when i remove Randzombie It Work Probelly
Reply
#5

and RETURN 1; and end of public
Reply
#6

try zombie mod in the gamemode section
Reply
#7

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..?
Reply
#8

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;
}
Reply
#9

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)