Ae galera, tipo q quando o medico usa /vida [id] [preco] , tipo q se ele tiver dentro do carro ou da moto
ele poderб da vida pra qual qr um player mesmo se estiver longe ... no caso ele poderб fazer isso mesmo se o player nao querer ...
Й q eu quero q ele sу possa da /vida se o medico e o player estiver dentro do veiculo e nao so o medico .
Se for possivel podem ver oq ta de errado nesse cod ? se puder ajudar dou um rep
PHP код:
if(strcmp(cmd, "/vida", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
GetPlayerName(playerid, sendername, sizeof(sendername));
new location = PlayerInfo[playerid][pLocal];
if(!strlen(tmp))
{
if(location != 255)
{
if(location < 99)
{
if(HouseInfo[location][hArm] == 1 && IsACop(playerid))
{
format(string, sizeof(string), "* %s pega seu colete.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
TogglePlayerControllable(playerid, 0);
GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
SetPlayerPos(playerid,1527.5,-12.1,1002.0);
PlayerInfo[playerid][pLocal] = 255;
SetPlayerInterior(playerid,99);
Spectate[playerid] = 257;
}
else if(HouseInfo[location][hHel] == 1)
{
SetPlayerHealth(playerid,100.0);
PlayerInfo[playerid][pDoenca] = 0;
SetPlayerDrunkLevel (playerid, 0);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Vocк foi curado.");
}
else
{
SendClientMessage(playerid, COLOR_GREY,"Este lugar nao tem lugar de se curar.");
}
return 1;
}
else if(location == 101)//Restaurant
{
SetPlayerHealth(playerid,100.0);
SetPlayerArmour(playerid,100.0);
PlayerInfo[playerid][pDoenca] = 0;
SetPlayerDrunkLevel (playerid, 0);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Vocк foi curado.");
}
else if(location == 102 && IsACop(playerid))//Police Armorry
{
SetPlayerHealth(playerid,100.0);
format(string, sizeof(string), "* %s Foi Curado.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
TogglePlayerControllable(playerid, 0);
GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
SetPlayerPos(playerid,1527.5,-12.1,1002.0);
PlayerInfo[playerid][pLocal] = 255;
SetPlayerInterior(playerid,99);
Spectate[playerid] = 257;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /vida [id] [preзo]");
return 1;
}
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /vida [id] [price]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 2000) { SendClientMessage(playerid, COLOR_GREY, " O Preзo nгo pode passar de 2000 !"); return 1; }
if (giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GRAD1, " Vocк nгo pode se curar!");
return 1;
}
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(gTeam[playerid] == TEAM_CYAN||PlayerInfo[playerid][pMembro]==4||PlayerInfo[playerid][pLider]==4)//model
{
new Veh = GetPlayerVehicleID(playerid);
if(IsAnAmbulanceCar(Veh))
{
format(string, sizeof(string), "~y~Voce foi curado ~n~~w~%s~n~~g~R$%d", giveplayer,moneys);
GameTextForPlayer(playerid, string, 5000, 1);
GivePlayerMoney(playerid,moneys);
GivePlayerMoney(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);
PlayerInfo[giveplayerid][pDoenca] = 0;
}
new colete = 0;
if(PlayerInfo[playerid][pPainPerk] > 0)
{
colete = 0 * PlayerInfo[playerid][pPainPerk]; colete += 100;
SetPlayerArmour(giveplayerid, colete);
}
else
{
colete = 100;
SetPlayerArmour(giveplayerid, 100);
PlayerInfo[giveplayerid][pDoenca] = 0;
}
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
PlayerPlaySound(giveplayerid, 1150, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Vocк foi curado, %d de saude e %d de colete por -R$%d",hp,colete,moneys);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE,string);
if(PlayerInfo[giveplayerid][pDoenca] > 0)
{
PlayerInfo[giveplayerid][pDoenca] = 0;
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* Vocк nгo estб infectado com nenhuma doenзa, por causa de cuidados Bombeiros!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Vocкs dois precisam estar no veнculo!");
return true;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб autorizado a usar o comando!");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Esse jogador estб offline");
}
}
return 1;
}