Script doesnt give me a weapon but complies just fine
#1

pawn Код:
forward Minigame();
new gSlots;

pawn Код:
public Minigame()
{
    new string[64];
    switch(random(5))
    {
        case 0:
        {
          GameTextForAll("~r~~h~~h~MINIGUN ~n~~y~~h~FIGHT", 3000, 3);
          for(new i = 0; i < gSlots; i++)
          {
            if(!IsPlayerConnected(i))
              continue;
            GivePlayerWeapon(i, 38, 20);
          }
        }
        case 1:
        {
          GameTextForAll("~r~~h~~h~ROCKET ~n~~y~~h~FIGHT", 3000, 3);
          for(new i = 0; i < gSlots; i++)
          {
            if(!IsPlayerConnected(i))
              continue;
            GivePlayerWeapon(i, 35, 4);
          }
        }
        case 2:
        {
          GameTextForAll("~r~~h~~h~CHAINSAW ~n~~y~~h~FIGHT", 3000, 3);
          for(new i = 0; i < gSlots; i++)
          {
            if(!IsPlayerConnected(i))
              continue;
            GivePlayerWeapon(i, 9, 1);
          }
        }
        case 3:
        {
          GameTextForAll("~r~~h~~h~GRENADE ~n~~y~~h~FIGHT", 3000, 3);
          for(new i = 0; i < gSlots; i++)
          {
            if(!IsPlayerConnected(i))
              continue;
            GivePlayerWeapon(i, 16, 10);
          }
        }
        case 4:
        {
          GameTextForAll("~r~~h~~h~FLAMETHROWER ~n~~y~~h~FIGHT", 3000, 3);
          for(new i = 0; i < gSlots; i++)
          {
            if(!IsPlayerConnected(i))
              continue;
            GivePlayerWeapon(i, 37, 500);
          }
        }
    }
}
Reply
#2

Well erm...probably I'm mistaken but why do you continue if(!IsPlayerConnected(i))? Doesn't that mean your giving the weapon only if the player is not connected?
Reply
#3

it gives the player a weapon if the player is connect to the server
Reply
#4

No it doesn't

Код:
if(!IsPlayerConnected(i))
if(! <<<< // it means FALSE that means if he's not connected. Learn to code
Reply
#5

edited
for(new i = 0; i < gSlots; i++)
to
for(new i;i<MAX_PLAYERS;i++)
Reply
#6

Quote:
Originally Posted by Gamer007
No it doesn't

Код:
if(!IsPlayerConnected(i))
if(! <<<< // it means FALSE that means if he's not connected. Learn to code
He's right..
He is doing !IsPlayerConnected(i) continue;
Reply
#7

well i deleted the ! but it still doesnt work
Reply
#8

Quote:
Originally Posted by yezizhu
edited
for(new i = 0; i < gSlots; i++)
to
for(new i;i<MAX_PLAYERS;i++)
Did you make this HydraX?
Reply
#9

Here is what they all mean HydraX.

pawn Код:
public Minigame()
{
    new string[64];
    switch(random(5))
    {
        case 0:
        {
          GameTextForAll("~r~~h~~h~MINIGUN ~n~~y~~h~FIGHT", 3000, 3);
          for(new i;i<MAX_PLAYERS;i++)
          {
            if(IsPlayerConnected(i))
            GivePlayerWeapon(i, 38, 20);
          }
        }
        case 1:
        {
          GameTextForAll("~r~~h~~h~ROCKET ~n~~y~~h~FIGHT", 3000, 3);
          for(new i;i<MAX_PLAYERS;i++)
          {
            if(IsPlayerConnected(i))
              continue;
            GivePlayerWeapon(i, 35, 4);
          }
        }
        case 2:
        {
          GameTextForAll("~r~~h~~h~CHAINSAW ~n~~y~~h~FIGHT", 3000, 3);
          for(new i;i<MAX_PLAYERS;i++)
          {
            if(IsPlayerConnected(i))
            GivePlayerWeapon(i, 9, 1);
          }
        }
        case 3:
        {
          GameTextForAll("~r~~h~~h~GRENADE ~n~~y~~h~FIGHT", 3000, 3);
          for(new i;i<MAX_PLAYERS;i++)
          {
            if(IsPlayerConnected(i))
            GivePlayerWeapon(i, 16, 10);
          }
        }
        case 4:
        {
          GameTextForAll("~r~~h~~h~FLAMETHROWER ~n~~y~~h~FIGHT", 3000, 3);
          for(new i;i<MAX_PLAYERS;i++)
          {
            if(IsPlayerConnected(i))
            GivePlayerWeapon(i, 37, 500);
          }
        }
    }
}
Reply
#10

i think its not correct

Код:
for(new i;i<MAX_PLAYERS;i++)
          {
i think this code won't work it's gotta be like this:

Код:
for(new i=0;i<MAX_PLAYERS;i++)
          {
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)