Need Help!
#1

Hi Readers

I need some help with Commands.
As I am new to scripting. I want to know something:

How do I make a /heal command that is only available for medics?
Could you make me an example?
Thanks.
Reply
#2

best place to learn more about scripting is here: wiki.sa-mp.com

for your command youll need this: https://sampwiki.blast.hk/wiki/SetPlayerHealth

pawn Код:
//Sets the players health to full
public OnPlayerCommandText(playerid, text[])
{
  if(strcmp(text, "/heal", true)
  {
    SetPlayerHealth(playerid, 100.0);
  }
  return 0;
}
Reply
#3

No no no... I want it that only medics can use the Cmd. I want to know how that works.. I know the Cmd...
Thanks,
Reply
#4

Quote:
Originally Posted by waza75
No no no... I want it that only medics can use the Cmd. I want to know how that works.. I know the Cmd...
Thanks,
do you use teams or special variables?
Reply
#5

Do you use teams? like gTeam?
Reply
#6

gTeam with classes in the team
Team PLox has: Soldier Etc
Reply
#7

Well use a simple check like this.

pawn Код:
if(strcmp(cmdtext, "/heal, true) == 0)
{
    if(gTeam[playerid] == TEAM_MEDIC)
    {
        // command.
    }
    return 1;
}
Reply
#8

Can I also put the skin id of the medics in place of TEAM_MEDICS?
Reply
#9

What like when he picks a skin he is assigned to the team? Or if he is a certain skin he can use /heal?
Reply
#10

Example: Medics have skin 88 and 89
None of the other skins is 88 and 89
Can you make it that only skin 88 and 89 can use /heal??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)