Class System Help! +REP
#1

i want to make a command named /heal for medics so only medics can heal his or her team member if the player is

in other team then the medic can't heal and also player needs to be close to be healed and needs to be team member

and player can use this /heal command every 2 minutes and also another command /fix so if player is in any vehicle

he can fix it every 2 minutes he can use the command and if player is not in vehicle error message

and /heal for Medic and /fix for Mechanic and my teams are

Soviet Union
Russian Force
Spanish Invaders
US Army
Reply
#2

pawn Код:
CMD:heal(playerid,params[])
{
    new tid;
    new Float:health
    if(sscanf(params,"ud",tid,Float:health)) return SendClientMessage(playerid,-1,"USAGE: /heal [id] [value]");
    if(!IsPlayerConnected(tid)) return SendClientMessage(playerid,-1,"Error: Invalid ID ");
    if(GetPlayerTeam(playerid) == Medic)
    {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if(!IsPlayerInRangeOfPoint(tid, 5.0, x, y, z)) return SendClientMessage(playerid,-1,"Your not near anyone");
    SetPlayerHealth(tid,Float:health);
    }
    return 1;
}
Reply
#3

to check if you gonna heal a team member or not

put this

pawn Код:
if(GetPlayerTeam(playerid) != MEDIC) return //do whatever you want

//!= means if not.
Reply
#4

Quote:
Originally Posted by Romel
Посмотреть сообщение
to check if you gonna heal a team member or not

put this

pawn Код:
if(GetPlayerTeam(playerid) != MEDIC) return //do whatever you want

//!= means if not.
i was looking for that tho but i missed it Dx , thanks
Reply
#5

i also forgot this part

pawn Код:
if(GetPlayerTeam(id) != MEDIC) return //do whatever you want
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)