#1

hello guys i try to make /hme command with dcmd but i faild this command should be /healme ...

i try if player who is in medic team write /hme it will heal him for random health, like +10 hp or +20 hp etc etc but i try with

new RandomHP()
{
(10),(20) etc etc
};

it was something like example up here than i made under command

bla

baballbal

SetPlayerHealth(playerid,RandomHP);

but there is error argumen mismatch 2 or something liek that , how i can make that for random hp ?

+ how i can make timer for that command can be used just once per 1 min ? ty for any help
Reply
#2

pawn Код:
new RandomHP[] = {10, 20, 30, 40};

rand = random(sizeof(RandomHP));
/*this will make a random number from 0 to the arrays size which is in this case 4
the possible numbers which can be generated are 0, 1, 2 and 3*/

SetPlayerHealth(playerid,RandomHP[rand]);
pawn Код:
new CmdLock[MAX_PLAYERS];
dcmd_hme(playerid, params[])
{
  if(CmdLock[playerid] == 1)
  {
    SendClientMessage(playerid, color, "Don't use the heal command to often!");
    return 1;
  }
  //heal player and stuff
  CmdLock[playerid] = 1;
  SetTimerEx("HealCmdLock", 1000, false, "d", playerid);
  return 1;
}

forward HealCmdLock(playerid);
public HealCmdLock(playerid)
{
  CmdLock[playerid] = 0;
}
Reply
#3

ty
Reply
#4

now i try and get some errors here is full code

http://pastebin.com/m5b96519a

here are errors

Код:
C:\Documents and Settings\samp\Desktop\Server2\gamemodes\WeedsRP.pwn(83) : error 010: invalid function or declaration
C:\Documents and Settings\samp\Desktop\Server2\gamemodes\WeedsRP.pwn(248) : error 017: undefined symbol "rand"
C:\Documents and Settings\samp\Desktop\Server2\gamemodes\WeedsRP.pwn(240) : warning 203: symbol is never used: "params"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#5

forward HealCmdLock(playerid);
should be on top of your script.

and add this before rand = random(sizeof(RandomHP)); --> new rand;
In your command.

And to get the warning away add #pragma unused params in your command.

I think that should work.
Reply
#6

ty but still error

here is the code:

http://pastebin.com/m6694a578

and here is error

Код:
C:\Documents and Settings\samp\Desktop\Server2\gamemodes\WeedsRP.pwn(87) : error 010: invalid function or declaration
C:\Documents and Settings\samp\Desktop\Server2\gamemodes\WeedsRP.pwn(249) : warning 203: symbol is never used: "params"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#7

You have not put #pragma unused params yet.

as for line 87 whats the code on it.
Reply
#8

still same crap now i have like this

Код:
forward HealCmdLock(playerid);

#pragma unused params

new CmdLock[MAX_PLAYERS];

new RandomHP[] = {17, 37, 65, 77};

new rand;
rand = random(sizeof(RandomHP));
/*this will make a random number from 0 to the arrays size which is in this case 4
the possible numbers which can be generated are 0, 1, 2 and 3*/
and now here are errors !!!!!

Код:
C:\Documents and Settings\samp\Desktop\Server2\gamemodes\WeedsRP.pwn(82) : error 017: undefined symbol "params"
C:\Documents and Settings\samp\Desktop\Server2\gamemodes\WeedsRP.pwn(89) : error 010: invalid function or declaration
C:\Documents and Settings\samp\Desktop\Server2\gamemodes\WeedsRP.pwn(251) : warning 203: symbol is never used: "params"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
ty for help anyway
Reply
#9

Use the random function in the heal cmd
Reply
#10

I would do something like this and forget the rest that is listed above.

pawn Код:
new Health = random(6);//Number of combination's here
    if (Health == 0)
    {
      SetPlayerHealth(playerid, 100);
    }
    if (Health == 1)
    {
      SetPlayerHealth(playerid, 50);
    }
    if (Health == 2)
    {
      SetPlayerHealth(playerid, 35);
    }
}

//etc like that make whatever combination's you want.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)