SA-MP Forums Archive
[Ajuda] Comando /Vida - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Comando /Vida (/showthread.php?tid=461451)



Comando /Vida - Samuel300 - 02.09.2013

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(cmdtextidx);
            
GetPlayerName(playeridsendernamesizeof(sendername));
            new 
location PlayerInfo[playerid][pLocal];
            if(!
strlen(tmp))
            {
                if(
location != 255)
                {
                    if(
location 99)
                    {
                        if(
HouseInfo[location][hArm] == && IsACop(playerid))
                        {
                            
format(stringsizeof(string), "* %s pega seu colete."sendername);
                            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            
TogglePlayerControllable(playerid0);
                            
GetPlayerPos(playeridUnspec[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 (playerid0);
                            
PlayerPlaySound(playerid11500.00.00.0);
                            
SendClientMessage(playeridCOLOR_LIGHTBLUE,"Vocк foi curado.");
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_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 (playerid0);
                        
PlayerPlaySound(playerid11500.00.00.0);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUE,"Vocк foi curado.");
                    }
                    else if(
location == 102 && IsACop(playerid))//Police Armorry
                    
{
                        
SetPlayerHealth(playerid,100.0);
                        
format(stringsizeof(string), "* %s Foi Curado."sendername);
                        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        
TogglePlayerControllable(playerid0);
                        
GetPlayerPos(playeridUnspec[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(playeridCOLOR_GRAD2"USE: /vida [id] [preзo]");
                    return 
1;
                }
            }
            
giveplayerid ReturnUser(tmp);
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USE: /vida [id] [price]");
                return 
1;
            }
            
moneys strval(tmp);
            if(
moneys || moneys 2000) { SendClientMessage(playeridCOLOR_GREY"   O Preзo nгo pode passar de 2000 !"); return 1; }
            if (
giveplayerid == playerid)
            {
                
SendClientMessage(playeridCOLOR_GRAD1"   Vocк nгo pode se curar!");
                return 
1;
            }
            if (
IsPlayerConnected(giveplayerid))
            {
                if(
giveplayerid != INVALID_PLAYER_ID)
                {
                    
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    if(
gTeam[playerid] == TEAM_CYAN||PlayerInfo[playerid][pMembro]==4||PlayerInfo[playerid][pLider]==4)//model
                    
{
                        new 
Veh GetPlayerVehicleID(playerid);
                        if(
IsAnAmbulanceCar(Veh))
                        {
                            
format(stringsizeof(string), "~y~Voce foi curado ~n~~w~%s~n~~g~R$%d"giveplayer,moneys);
                            
GameTextForPlayer(playeridstring50001);
                            
GivePlayerMoney(playerid,moneys);
                            
GivePlayerMoney(giveplayerid,-moneys);
                            new 
hp 0;
                            if(
PlayerInfo[playerid][pPainPerk] > 0)
                            {
                                
hp 20 PlayerInfo[playerid][pPainPerk]; hp += 100;
                                
SetPlayerHealth(giveplayeridhp);
                            }
                            else
                            {
                                
hp 100;
                                
SetPlayerHealth(giveplayerid100);
                                
PlayerInfo[giveplayerid][pDoenca] = 0;
                            }
                            new 
colete 0;
                            if(
PlayerInfo[playerid][pPainPerk] > 0)
                            {
                                
colete PlayerInfo[playerid][pPainPerk]; colete += 100;
                                
SetPlayerArmour(giveplayeridcolete);
                            }
                            else
                            {
                                
colete 100;
                                
SetPlayerArmour(giveplayerid100);
                                
PlayerInfo[giveplayerid][pDoenca] = 0;
                            }
                            
PlayerPlaySound(playerid11500.00.00.0);
                            
PlayerPlaySound(giveplayerid11500.00.00.0);
                            
format(stringsizeof(string), "Vocк foi curado, %d de saude e %d de colete por -R$%d",hp,colete,moneys);
                            
SendClientMessage(giveplayeridCOLOR_LIGHTBLUE,string);
                            if(
PlayerInfo[giveplayerid][pDoenca] > 0)
                            {
                                
PlayerInfo[giveplayerid][pDoenca] = 0;
                                
SendClientMessage(giveplayeridCOLOR_LIGHTBLUE"* Vocк nгo estб infectado com nenhuma doenзa, por causa de cuidados Bombeiros!");
                            }
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_GRAD1"  Vocкs dois precisam estar no veнculo!");
                            return 
true;
                        }
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GRAD1"Vocк nгo estб autorizado a usar o comando!");
                        return 
1;
                    }
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD1" Esse jogador estб offline");
            }
        }
        return 
1;
    } 



Re: Comando /Vida - Samuel300 - 02.09.2013

auguem poderia ajudar ?