#1

Hello guys, I need small help

I'm using Zombie Apocalypse script by Kitten, However in the script, I need to make only medic can /cure the infected player if the medic near the infected player. Otherwise it will show up message by saying "You're not near the target"

Here's the current code for cure

pawn Код:
CMD:cure(playerid,params[])
{
    if(team[playerid] == TEAM_HUMAN)
    {
        if(pInfo[playerid][pHumanClass] == MEDIC || pInfo[playerid][pHumanClass] == ADVANCEDMEDIC || pInfo[playerid][pHumanClass] == HEAVYMEDIC || pInfo[playerid][pHumanClass] == VIPMEDIC || pInfo[playerid][pHumanClass] == DOCTOR)
        {
            new targetid,string[128],str[256];
            if(sscanf(params,"u", targetid)) return SendClientMessage(playerid,-1,""chat" /cure [playerid]");

            if(pInfo[targetid][IsPlayerInfected] == 1)
            {
                CurePlayer(targetid);
                format(string,sizeof(string),"~n~~n~~n~~n~~g~%s~w~ %s has cured you",GetClassName(playerid),PlayerName(playerid));
                GameTextForPlayer(targetid,string,3500,5);
                format(str,sizeof(str),""chat""COL_LGREEN" %s %s has cured %s",GetClassName(playerid),PlayerName(playerid),PlayerName(targetid));
                SendClientMessageToAll(-1,str);
                GivePlayerXP(playerid,20);
            }
            else return SendClientMessage(playerid,-1,""chat" The player you are trying to cure isn't infected");
        }
        else return SendClientMessage(playerid,-1,""chat""COL_LGREEN" You'll need to be an Medic & Advanced Medic or V.I.P Medic to use this command!");
    }
    else return SendClientMessage(playerid,-1,""chat""COL_LGREEN" You'll need to be an human to use this command!");
    return 1;
}
and also medics can /cure himself using this command, I need to disable it

Thanks in advance
Reply
#2

do this

Quote:

if(playerid == tragetid)
{
youir message
return 1;
}

Reply
#3

Quote:
Originally Posted by Kenway
Посмотреть сообщение
do this
It's just giving away message, You can't stop cure yourself from that.
Reply
#4

pawn Код:
CMD:cure(playerid,params[])
{    
    if(team[playerid] == TEAM_HUMAN)
    {
        if(pInfo[playerid][pHumanClass] == MEDIC || pInfo[playerid][pHumanClass] == ADVANCEDMEDIC || pInfo[playerid][pHumanClass] == HEAVYMEDIC || pInfo[playerid][pHumanClass] == VIPMEDIC || pInfo[playerid][pHumanClass] == DOCTOR)
        {
            new targetid,string[128],str[256], Float:Pos[ 4 ];
            if(sscanf(params,"u", targetid)) return SendClientMessage(playerid,-1,""chat" /cure [playerid]");

            GetPlayerPos(targetid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ]);
            if(!IsPlayerInRangeOfPoint(playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ]) return SendClientMessage(playerid, -1, "You're not near the targeted player!");
           
            if(pInfo[targetid][IsPlayerInfected] == 1)
            {
                CurePlayer(targetid);
                format(string,sizeof(string),"~n~~n~~n~~n~~g~%s~w~ %s has cured you",GetClassName(playerid),PlayerName(playerid));
                GameTextForPlayer(targetid,string,3500,5);
                format(str,sizeof(str),""chat""COL_LGREEN" %s %s has cured %s",GetClassName(playerid),PlayerName(playerid),PlayerName(targetid));
                SendClientMessageToAll(-1,str);
                GivePlayerXP(playerid,20);
            }
            else return SendClientMessage(playerid,-1,""chat" The player you are trying to cure isn't infected");
        }
        else return SendClientMessage(playerid,-1,""chat""COL_LGREEN" You'll need to be an Medic & Advanced Medic or V.I.P Medic to use this command!");
    }
    else return SendClientMessage(playerid,-1,""chat""COL_LGREEN" You'll need to be an human to use this command!");
    return 1;
}
Reply
#5

Quote:
Originally Posted by Strier
Посмотреть сообщение
pawn Код:
CMD:cure(playerid,params[])
{    
    if(team[playerid] == TEAM_HUMAN)
    {
        if(pInfo[playerid][pHumanClass] == MEDIC || pInfo[playerid][pHumanClass] == ADVANCEDMEDIC || pInfo[playerid][pHumanClass] == HEAVYMEDIC || pInfo[playerid][pHumanClass] == VIPMEDIC || pInfo[playerid][pHumanClass] == DOCTOR)
        {
            new targetid,string[128],str[256], Float:Pos[ 4 ];
            if(sscanf(params,"u", targetid)) return SendClientMessage(playerid,-1,""chat" /cure [playerid]");

            GetPlayerPos(targetid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ]);
            if(!IsPlayerInRangeOfPoint(playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ]) return SendClientMessage(playerid, -1, "You're not near the targeted player!");
           
            if(pInfo[targetid][IsPlayerInfected] == 1)
            {
                CurePlayer(targetid);
                format(string,sizeof(string),"~n~~n~~n~~n~~g~%s~w~ %s has cured you",GetClassName(playerid),PlayerName(playerid));
                GameTextForPlayer(targetid,string,3500,5);
                format(str,sizeof(str),""chat""COL_LGREEN" %s %s has cured %s",GetClassName(playerid),PlayerName(playerid),PlayerName(targetid));
                SendClientMessageToAll(-1,str);
                GivePlayerXP(playerid,20);
            }
            else return SendClientMessage(playerid,-1,""chat" The player you are trying to cure isn't infected");
        }
        else return SendClientMessage(playerid,-1,""chat""COL_LGREEN" You'll need to be an Medic & Advanced Medic or V.I.P Medic to use this command!");
    }
    else return SendClientMessage(playerid,-1,""chat""COL_LGREEN" You'll need to be an human to use this command!");
    return 1;
}
warning 202: number of arguments does not match definition
error 001: expected token: ")", but found "return"

Thank you, But I'm getting above two errors while compiling, in line 2168 and this is the line 2168

pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ]) return SendClientMessage(playerid, -1, "You're not near the targeted player!");
Reply
#6

pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 5.0, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ])) return SendClientMessage(playerid, -1, "You're not near the targeted player!");
If the player isn't in a range of 5 metters, the targetid can't be healed. (Fixed)
Reply
#7

Quote:
Originally Posted by Strier
Посмотреть сообщение
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 5.0, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ])) return SendClientMessage(playerid, -1, "You're not near the targeted player!");
If the player isn't in a range of 5 metters, the targetid can't be healed. (Fixed)
Yeah brother, That's working. Thank you and What about other thing? Medics can /cure themself, Anyway to disable it?
Reply
#8

pawn Код:
if(playerid == targetid) return SendClientMessage(playerid, -1, "You can't cure yourself");
i think it should work xd

Add it below IsPlayerInRangeOfPoint.
Reply
#9

Quote:
Originally Posted by Strier
Посмотреть сообщение
pawn Код:
if(playerid == targetid) return SendClientMessage(playerid, -1, "You can't cure yourself");
i think it should work xd

Add it below IsPlayerInRangeOfPoint.
Aha, Yeah - It's working <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)