SA-MP Forums Archive
Need Help! - 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: Need Help! (/showthread.php?tid=78856)



Need Help! - waza75 - 23.05.2009

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.


Re: Need Help! - Think - 23.05.2009

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;
}



Re: Need Help! - waza75 - 23.05.2009

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,


Re: Need Help! - Think - 23.05.2009

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?


Re: Need Help! - Lewwy - 23.05.2009

Do you use teams? like gTeam?


Re: Need Help! - waza75 - 23.05.2009

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



Re: Need Help! - Lewwy - 23.05.2009

Well use a simple check like this.

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



Re: Need Help! - waza75 - 23.05.2009

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


Re: Need Help! - Lewwy - 23.05.2009

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


Re: Need Help! - waza75 - 23.05.2009

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??