SA-MP Forums Archive
Problem with /heal, but where? - 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)
+--- Thread: Problem with /heal, but where? (/showthread.php?tid=415379)



Problem with /heal, but where? - jakejohnsonusa - 12.02.2013

I get my"Server: Unknown Command" message with my /heal command, telling me somthing is wrong with it somewhere... But I can't find where!

Can someone please look through it and tell me if they see anything

(I will +1 Rep for those of you who care ).

Thanks in advance: jakejohnsonusa


Code:
pawn Код:
if(strcmp(cmd, "/heal", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);

            new location = PlayerInfo[playerid][pLocal];
            new house = PlayerInfo[playerid][pPhousekey];
            if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
            {
                if(HouseInfo[location][hArm] == 1)
                {
                    format(string, sizeof(string), "* %s puts on body armour.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                    SafeSetPlayerArmour(playerid, 50.0);
                }
                else
                {
                    format(string, sizeof(string), "This place does not have armour upgrades. Do /hu to get it.");
                    SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
                }
                if(HouseInfo[location][hHel] == 1)
                {
                    new Float:tempheal;
                    GetPlayerHealth(playerid,tempheal);
                    if ( tempheal < 100.0)
                    {
                        SetPlayerHealth(playerid,100.0);
                        PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
                        format(string, sizeof(string), "You have been healed fully.");
                        SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, TEAM_GREEN_COLOR,"You are already healed fully.");
                        return 1;
                    }
                }
                else
                {
                    format(string, sizeof(string), "This place does not have healing upgrade. Do /hu to get it.");
                    SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
                    return 1;
                }
            }
            else if(location == 101)//Restaurant
            {
                new Float:tempheal;
                GetPlayerHealth(playerid,tempheal);
                if ( tempheal < 100.0)
                {
                    SetPlayerHealth(playerid,100.0);
                    PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
                    format(string, sizeof(string), "You have been healed fully.");
                    SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, TEAM_GREEN_COLOR,"You are already healed fully.");
                    return 1;
                }
            }
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /heal [playerid/PartOfName]");
                return 1;
            }
            new playa;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(PlayerInfo[playerid][pLeader] == 12 || PlayerInfo[playerid][pMember] == 12)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        if (ProxDetectorS(6.0, playerid, playa))
                        {
                            new Float:PlayerHealth;
                            new Health = GetPlayerHealth(playa, PlayerHealth);
                            if(Health <= 99.9)
                            {
                                SetPlayerHealth(playa, PlayerHealth+20);
                                GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                                format(string, sizeof(string), "You are healing someone!");
                                SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                                format(string, sizeof(string), "You are being healed by %s!",sendername);
                                SendClientMessage(playa, TEAM_GROVE_COLOR, string);
                            }
                            else
                            {
                                format(string, sizeof(string), "You can not heal them any more, Only a doctor is that advanced!");
                                SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            }
                        }
                        new y, m, d;
                        new h,mi,s;
                        getdate(y,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /heal",d,m,y,h,mi,s,sendername);
                        CommandLog(string);
                        return 1;
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "** You are not authorized to use that command!");
            }
        }
        return 1;
    }



Re: Problem with /heal, but where? - Brandon_More - 12.02.2013

You need to be at a house exit if it does not work then go to the house entrance and do /hu and it will upgrade the house to Armor and Heal.

As far as i can see, but i dont know anything about scripting so... xD