18.02.2010, 16:47
Hello!
With this cmd you can heal players if you both are in a ambulance, you can do it over and over again even if the players health is 100.
So how can i do a player health check so you cant abuse the cmd?
i guess the check would look something like this?
With this cmd you can heal players if you both are in a ambulance, you can do it over and over again even if the players health is 100.
So how can i do a player health check so you cant abuse the cmd?
i guess the check would look something like this?
Код:
CheckplayerHealth(playerid, 100);
SetPlayerHealth(giveplayerid, 100);
Код:
if(strcmp(cmd, "/Heal", true) == 0)
{
if(Medic(playerid))
{
new tmpcar = GetPlayerVehicleID(playerid);
if(MedicCar(tmpcar))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_WHITE, "USAGE: /Heal <Player ID>");
return 1;
}
new giveplayerid = ReturnUser(tmp);
if(giveplayerid == playerid)
{
SCM(playerid, COLOR_RED, "MAIN ERROR(You can't heal yourself!)");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(tmpcar == GetPlayerVehicleID(giveplayerid))
{
GetPlayerName(playerid, UserName, sizeof(UserName));
GetPlayerName(giveplayerid, UserName2, sizeof(UserName2));
SetPlayerHealth(giveplayerid, 100);
format(Text, sizeof(Text), "** You got healed by medic %s! **", UserName);
SCM(giveplayerid, COLOR_GREEN, Text);
format(Text, sizeof(Text), "** You healed %s and earned $750! **", UserName2);
SCM(playerid, COLOR_GREEN, Text);
GivePlayerMoney(playerid, 750);
}
else{SCM(playerid, COLOR_RED, "MAIN ERROR(That person isn't in you'r ambulance!)");}
}
else{SCM(playerid, COLOR_RED, "MAIN ERROR(That player is offline!)");}
}
else{SCM(playerid, COLOR_RED, "MAIN ERROR(You are not in an ambulance!)");}
}
else{SCM(playerid, COLOR_RED, "MAIN ERROR(You are not a medic)");}
return 1;
}


