SA-MP Forums Archive
Some problem with this - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Some problem with this (/showthread.php?tid=151535)



Some problem with this - ViruZZzZ_ChiLLL - 30.05.2010

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


Re: Some problem with this - Conroy - 30.05.2010

Don't use a variable array.

new SkinChosen[MAX_PLAYERS];


Re: Some problem with this - azzerking - 30.05.2010

Yes use

new skinchoosen

Good Work Conroy


Re: Some problem with this - ViruZZzZ_ChiLLL - 30.05.2010

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