/heal - Problem
#1

if player is in ambulance I cant give him /heal because it says that I don't have upgrade at house.


PHP код:
if(strcmp(cmd, "/heal", true) == 0)
                    {
                        if(
IsPlayerConnected(playerid))
                        {
                            
tmp = strtok(cmdtext, idx);
                            
//new bouse = PlayerInfo[playerid][pPhousekey];
                            
new location = PlayerInfo[playerid][pLocal];
                            if(!
strlen(tmp))
                            {
                                if(
location != 255)
                                {
                                    if(
location < 99)
                                    {
                                        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);
                                            
SetPlayerArmour(playerid, 50.0);
                                        }
                                        else
                                        {
                                            
format(string, sizeof(string), "This place does not have armour upgrades.");
                                            
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 to 100 health.");
                                                
SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
                                            }
                                            else
                                            {
                                                
SendClientMessage(playerid, TEAM_GREEN_COLOR,"You are already healed to 100.");
                                            }
                                        }
                                        else
                                        {
                                            
format(string, sizeof(string), "This place does not have healing upgrades.");
                                            
SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
                                        }
                                        return 
1;
                                    }
                                }
                                else
                                {
                                    
SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /heal [playerid/PartOfName] [price]");
                                    return 
1;
                                }
                            }
                            
giveplayerid = ReturnUser(tmp);
                            
tmp = strtok(cmdtext, idx);
                            if(!
strlen(tmp))
                            {
                                
SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /heal [playerid/PartOfName] [price]");
                                return 
1;
                            }
                            
moneys = strval(tmp);
                            if(
moneys < 1 || moneys > 1000) { SendClientMessage(playerid, COLOR_GREY, "   Healing price not below 1 or above 1000!"); return 1; }
                            if (
giveplayerid == playerid)
                            {
                                
SendClientMessage(playerid, COLOR_GRAD1, "   You can not heal yourself!");
                                return 
1;
                            }
                            if (
IsPlayerConnected(giveplayerid))
                            {
                                if(
giveplayerid != INVALID_PLAYER_ID)
                                {
                                    
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                                    new 
giveambu = GetPlayerVehicleID(giveplayerid);
                                    new 
playambu = GetPlayerVehicleID(playerid);
                                    if(
gTeam[playerid] == 1||PlayerInfo[playerid][pJob] == 19)//model
                                    
{
                                        if (
IsAAmbulanceCar(playambu) && playambu == giveambu)
                                        {
                                            new 
Float:tempheal;
                                            
GetPlayerHealth(giveplayerid,tempheal);
                                            if(
tempheal >= 100.0)
                                            {
                                                
SendClientMessage(playerid, TEAM_GREEN_COLOR,"   That person is fully healed.");
                                                return 
1;
                                            }
                                            
format(string, sizeof(string), "~y~You healed ~n~~w~%s~n~~g~$%d", giveplayer,moneys);
                                            
GameTextForPlayer(playerid, string, 5000, 1);
                                            
GivePlayerCash(playerid,moneys);
                                            
GivePlayerCash(giveplayerid,-moneys);
                                            new 
hp = 0;
                                            if(
PlayerInfo[playerid][pPainPerk] > 0)
                                            {
                                                
hp = 20 * PlayerInfo[playerid][pPainPerk]; hp += 100;
                                                
SetPlayerHealth(giveplayerid, hp);
                                            }
                                            else
                                            {
                                                
hp = 100;
                                                
SetPlayerHealth(giveplayerid, 100);
                                            }
                                            
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
                                            
PlayerPlaySound(giveplayerid, 1150, 0.0, 0.0, 0.0);
                                            
format(string, sizeof(string), "You have been healed to %d health -$%d",hp,moneys);
                                            
SendClientMessage(giveplayerid, TEAM_GREEN_COLOR,string);
                                            if(
STDPlayer[giveplayerid] > 0)
                                            {
                                                
STDPlayer[giveplayerid] = 0;
                                                
SendClientMessage(giveplayerid, COLOR_WHITE, "* You are no longer infected with a STD anymore because of the Medics help!");
                                            }
                                        }
                                        else
                                        {
                                            
SendClientMessage(playerid, COLOR_GRAD1, "** One of you is not in the Ambulance / Chopper!");
                                            return 
1;
                                        }
                                    }
                                    else
                                    {
                                        
SendClientMessage(playerid, COLOR_GRAD1, "** You are not authorized to use that command!");
                                        return 
1;
                                    }
                                }
                            }
                            else
                            {
                                
format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
                                
SendClientMessage(playerid, COLOR_GRAD1, string);
                            }
                        }
                        return 
1;
                    } 
Reply
#2

anyone help?
Reply
#3

There's some issue with this HouseInfo[location][hHel]. Check the code where you assign values to this variable.
Reply
#4

I tested many /heal cmd from different gamemodes.ex:Ravens..and lots.. they don't work..
Reply
#5

Copies never work, you have to make your own commands or change carefully the coped ones to your own needs.
Reply
#6

I put my own and it doesent work..
Reply
#7

Quote:
Originally Posted by Akcent_Voltaj
Посмотреть сообщение
I put my own and it doesent work..
Can you show us the code then?
Reply
#8

The heal command requires a parameter to be used inside an ambulance.
Example: '/HEAL Joe_Staff'

if it says 'one of you is not inside the ambulance' you have to change your function known as "IsAAmbulanceCar" so it's as follows
pawn Код:
stock IsAAmbulanceCar(vehicleid) //ignore the really bad English
{
    return (GetVehicleModel(vehicleid)==416)
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)