SA-MP Forums Archive
A command for my Server - 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: A command for my Server (/showthread.php?tid=367300)



A command for my Server - CrazyManiac - 09.08.2012

Hello guys!

I am sorry if this question is not related to this Thread, im just new here. Does somebody knows here how to
Make the command ''/search'' for my Zombie Server? It has to be like... when someone types /search, he will get
something random, like armor, health, a weapon, or whatever. There have to be about 4 or 5 random items, some
of them are nothing. I know pretty much about scripting, but this is what i dont know yet (Probably its simple lol)!

I hope you guys know what im trying to make and some of you are able to help maybe

Greetings, CrazyManiac.


Re: A command for my Server - CrazyManiac - 09.08.2012

Bumppppppppppppp


Re: A command for my Server - CrazyManiac - 09.08.2012

Ah cmon... Nobody knows how to make this? Help me please


Re: A command for my Server - XStormiest - 09.08.2012

pawn Код:
//No system
        if(strcmp(cmdtext,"/search",true) )
       {
                 new rand;
               rand = (5)
                 switch(random(rand) )
                  {
                         case 0: SetPlayerHealth(playerid,100);
                        case 1: SetPlayerArmour(playerid,100);
                           case 2: GivePlayerWeapon(playerid,24,500);
                              case 3: GivePlayerWeapon(playerid,30,500);
                               case 4: GivePlayerMoney(playerid,500);
                                    case 5: GivePlayerMoeny(playerid,1000);
                  }
              return 1;
       }

//zcmd

CMD:search(playerid,params[])
{
    #pragma unused params
      new rand;
               rand = (5)
                 switch(random(rand) )
                  {
                         case 0: SetPlayerHealth(playerid,100);
                        case 1: SetPlayerArmour(playerid,100);
                           case 2: GivePlayerWeapon(playerid,24,500);
                              case 3: GivePlayerWeapon(playerid,30,500);
                               case 4: GivePlayerMoney(playerid,500);
                                    case 5: GivePlayerMoeny(playerid,1000);
                  }
   return 1;
}

//YCMD
YCMD:search(playerid,params[],help)
{
      #pragma unused params
      #pragma unused help
       new rand;
               rand = (5)
                 switch(random(rand) )
                  {
                         case 0: SetPlayerHealth(playerid,100);
                        case 1: SetPlayerArmour(playerid,100);
                           case 2: GivePlayerWeapon(playerid,24,500);
                              case 3: GivePlayerWeapon(playerid,30,500);
                               case 4: GivePlayerMoney(playerid,500);
                                    case 5: GivePlayerMoeny(playerid,1000);
                  }
   return 1;
}



Re: A command for my Server - xSkullx - 09.08.2012

REMOVED


Re: A command for my Server - CrazyManiac - 09.08.2012

C:\Documents and Settings\Tessa Krijnen\Mijn documenten\Fabians Fun Server (0.3e)\gamemodes\v3.4.pwn(2095) : warning 217: loose indentation
C:\Documents and Settings\Tessa Krijnen\Mijn documenten\Fabians Fun Server (0.3e)\gamemodes\v3.4.pwn(2096) : error 001: expected token: ";", but found "switch"
C:\Documents and Settings\Tessa Krijnen\Mijn documenten\Fabians Fun Server (0.3e)\gamemodes\v3.4.pwn(2096) : warning 217: loose indentation
C:\Documents and Settings\Tessa Krijnen\Mijn documenten\Fabians Fun Server (0.3e)\gamemodes\v3.4.pwn(2105) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Respuesta: Re: A command for my Server - HarlemSAMP - 09.08.2012

Quote:
Originally Posted by CrazyManiac
Посмотреть сообщение
C:\Documents and Settings\Tessa Krijnen\Mijn documenten\Fabians Fun Server (0.3e)\gamemodes\v3.4.pwn(2095) : warning 217: loose indentation
C:\Documents and Settings\Tessa Krijnen\Mijn documenten\Fabians Fun Server (0.3e)\gamemodes\v3.4.pwn(2096) : error 001: expected token: ";", but found "switch"
C:\Documents and Settings\Tessa Krijnen\Mijn documenten\Fabians Fun Server (0.3e)\gamemodes\v3.4.pwn(2096) : warning 217: loose indentation
C:\Documents and Settings\Tessa Krijnen\Mijn documenten\Fabians Fun Server (0.3e)\gamemodes\v3.4.pwn(2105) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Dude, don't just copy and paste it, look at the code!:

pawn Код:
CMD:search(playerid,params[])
{
    #pragma unused params
      new rand;
               rand = (5)
                 switch(random(rand) )
                  {
                         case 0: SetPlayerHealth(playerid,100);
                        case 1: SetPlayerArmour(playerid,100);
                           case 2: GivePlayerWeapon(playerid,24,500);
                              case 3: GivePlayerWeapon(playerid,30,500);
                               case 4: GivePlayerMoney(playerid,500);
                                    case 5: GivePlayerMoeny(playerid,1000);
                  }
   return 1;
}
Storm misspelled the line case 5:GivePlayerMoney(playerid,1000);
lol'ed


Re: A command for my Server - XStormiest - 09.08.2012

pawn Код:
CMD:search(playerid,params[])
{
    #pragma unused params
      new rand;
               rand = (5);
                 switch(random(rand) )
                  {
                         case 0: SetPlayerHealth(playerid,100);
                        case 1: SetPlayerArmour(playerid,100);
                           case 2: GivePlayerWeapon(playerid,24,500);
                              case 3: GivePlayerWeapon(playerid,30,500);
                               case 4: GivePlayerMoney(playerid,500);
                                    case 5: GivePlayerMoney(playerid,1000);
                  }
   return 1;
}
YCMD:search(playerid,params[],help)
{
      #pragma unused params
      #pragma unused help
       new rand;
               rand = (5);
                 switch(random(rand) )
                  {
                         case 0: SetPlayerHealth(playerid,100);
                        case 1: SetPlayerArmour(playerid,100);
                           case 2: GivePlayerWeapon(playerid,24,500);
                              case 3: GivePlayerWeapon(playerid,30,500);
                               case 4: GivePlayerMoney(playerid,500);
                                    case 5: GivePlayerMoney(playerid,1000);
                  }
   return 1;
}


if(strcmp(cmdtext,"/search",true) )
{
         new rand;
               rand = (5);
                 switch(random(rand) )
                  {
                         case 0: SetPlayerHealth(playerid,100);
                        case 1: SetPlayerArmour(playerid,100);
                           case 2: GivePlayerWeapon(playerid,24,500);
                              case 3: GivePlayerWeapon(playerid,30,500);
                               case 4: GivePlayerMoney(playerid,500);
                                    case 5: GivePlayerMoney(playerid,1000);
                  }
     return 1;
}
Fixed sorry but i maked it fast and i didn't test it , fine .. i make all 3 type of this because if you use of these command procesor this will be usefull but use only what you need don't place all 3 type of cmds in your script..


Re: A command for my Server - CrazyManiac - 09.08.2012

Right, well i am not that good in scripting... Im sorry O_o
I guess this topic is closed now, though i still dont know how to fix this.


Re: A command for my Server - CrazyManiac - 09.08.2012

Got it.