Some problem with this
#1

Okay, so I have this script, that if a player has already chosen the
skin it can't be chosen anymore by others :
pawn Код:
new SkinChosen[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
    if(skinid == 0)
    {
    if(SkinChosen[playerid] == 1)
    {
    SetPlayerHealth(playerid, 0);
    SendClientMessage(playerid, Red, "ERROR : The Skin is already chosen!");
    }
    if(SkinChosen[playerid] == 0)
    {
     SkinChosen[playerid] = 1;
     GivePlayerWeapon(playerid, 22, 180);
     GivePlayerWeapon(playerid, 25, 50);
     GivePlayerWeapon(playerid, 32, 210);
     GivePlayerWeapon(playerid, 30, 80);
     switch(random(3))
     {
      case 0: SetPlayerPos(playerid, 2469, -1689, 15);
      case 1: SetPlayerPos(playerid, 2469, -1689, 15);
      case 2: SetPlayerPos(playerid, 2469, -1689, 15);
     }
    }
    }
   
    if(skinid == 165)
    {
    if(SkinChosen[playerid] == 1)
    {
    SetPlayerHealth(playerid, 0);
    SendClientMessage(playerid, Red, "ERROR : The Skin is already chosen!");
    }
    if(SkinChosen[playerid] == 0)
    {
     GivePlayerWeapon(playerid, 24, 50);
     GivePlayerWeapon(playerid, 27, 50);
     GivePlayerWeapon(playerid, 39, 180);
     GivePlayerWeapon(playerid, 31, 80);
     policeleader1[playerid] = 1;
     SkinChosen[playerid] = 1;
     switch(random(3))
     {
      case 0: SetPlayerPos(playerid, 1529, -1677, 6);
      case 1: SetPlayerPos(playerid, 1529, -1677, 6);
      case 2: SetPlayerPos(playerid, 1529, -1677, 6);
     }
    }
    }
I have 2 Problems :
First :
Even though no one has chosen that skin, it still says, that it is chosen already.

Second :
I don't know why, some still can choose the skin.


Notes :

If you have a better suggestion for not spawning the player if the skin is already
is chosen, let me know
Reply
#2

Don't use a variable array.

new SkinChosen[MAX_PLAYERS];
Reply
#3

Yes use

new skinchoosen

Good Work Conroy
Reply
#4

Quote:
Originally Posted by Conroy
Don't use a variable array.

new SkinChosen[MAX_PLAYERS];
Ugh, lol, stupid me Thanks again man


Quote:
Originally Posted by Azzerking
Yes use

new skinchoosen

Good Work Conroy
:P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)