SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 02/06/2020, 03:27 PM   #1
OsamaBin
Little Clucker
 
Join Date: Apr 2020
Posts: 27
Reputation: 0
Default comando /pegarkit e /droparkit bugado

Preciso de ajuda nestes comandos:
PHP Code:
CMD:pegarkit(playerid)
{
    for(new 
0<MAX_PLAYERSi++)
    {
        if(
IsPlayerInRangeOfObject(ikit[i], 5.0))
        {
            new 
string2[200];
            
format(string2sizeof(string2), "%s pegou um Kit medico do chao."nome(playerid));
            
ProxDetector(10.0playeridstring2, -1, -1, -1, -1, -1);
            
DestroyObject(kit[playerid]);
            
SendClientMessage(playeridVermelho"Voce pegou um Kit medico dropado no chao!");
            
Pinfo[playerid][KitM] += 1;
            return 
1;
        }
        else
        {
            
SendClientMessage(playeridVermelho"Nenhum MedKit aqui!");
            return 
1;
        }
    }
    return 
1;

PHP Code:
CMD:droparkit(playerid)
{
    if(
Pinfo[playerid][KitM] == 0)
    {
        
SendClientMessage(playeridVermelho"Voce nao tem MedKits!");
        return 
1;
    }
    else
    {
        new 
FloatXFloatYFloatZ;
        
GetPlayerPos(playeridXYZ);
        
kit[playerid] = CreateObject(1241,X,Y,Z-1,0.0,0.0,0.0,300.0);
        
Pinfo[playerid][KitM] -=1;
        new 
string2[200];
         
format(string2sizeof(string2), "%s dropou um Kit medico."nome(playerid));
         
ProxDetector(10.0playeridstring2, -1, -1, -1, -1, -1);
        
SendClientMessage(playeridVermelho"Voce dropou um Kit no Chao!");
        return 
1;
    }

O jogador nao pega o kit, so diz "Nenhum medkit aqui" mesmo com ele dropado
OsamaBin is offline   Reply With Quote
Old 02/06/2020, 05:24 PM   #2
MasterWinX
Big Clucker
 
MasterWinX's Avatar
 
Join Date: Mar 2019
Location: San Fierro
Posts: 84
Reputation: 1
Default Re: comando /pegarkit e /droparkit bugado

retira o loop e muda para:
PHP Code:
  if(IsPlayerInRangeOfObject(playeridkit[playerid], 5.0)) 
__________________
MasterWinX is offline   Reply With Quote
Old 02/06/2020, 06:38 PM   #3
k2bi
Big Clucker
 
k2bi's Avatar
 
Join Date: Sep 2017
Location: Novo Horizonte - SP
Posts: 165
Reputation: 5
Default Re: comando /pegarkit e /droparkit bugado

Coloquei Playerid em IsPlayerInRangeOfObject, vê se funciona
PHP Code:
CMD:pegarkit(playerid)
{
    for(new 
0<MAX_PLAYERSi++)
    {
        if(
IsPlayerInRangeOfObject(playeridkit[i], 5.0))
        {
            new 
string2[200];
            
format(string2sizeof(string2), "%s pegou um Kit medico do chao."nome(playerid));
            
ProxDetector(10.0playeridstring2, -1, -1, -1, -1, -1);
            
DestroyObject(kit[playerid]);
            
SendClientMessage(playeridVermelho"Voce pegou um Kit medico dropado no chao!");
            
Pinfo[playerid][KitM] += 1;
            return 
1;
        }
        else
        {
            
SendClientMessage(playeridVermelho"Nenhum MedKit aqui!");
            return 
1;
        }
    }
    return 
1;

k2bi is offline   Reply With Quote
Old 02/06/2020, 09:19 PM   #4
OsamaBin
Little Clucker
 
Join Date: Apr 2020
Posts: 27
Reputation: 0
Default Re: comando /pegarkit e /droparkit bugado

Quote:
Originally Posted by k2bi View Post
Coloquei Playerid em IsPlayerInRangeOfObject, vê se funciona
PHP Code:
CMD:pegarkit(playerid)
{
    for(new 
0<MAX_PLAYERSi++)
    {
        if(
IsPlayerInRangeOfObject(playeridkit[i], 5.0))
        {
            new 
string2[200];
            
format(string2sizeof(string2), "%s pegou um Kit medico do chao."nome(playerid));
            
ProxDetector(10.0playeridstring2, -1, -1, -1, -1, -1);
            
DestroyObject(kit[playerid]);
            
SendClientMessage(playeridVermelho"Voce pegou um Kit medico dropado no chao!");
            
Pinfo[playerid][KitM] += 1;
            return 
1;
        }
        else
        {
            
SendClientMessage(playeridVermelho"Nenhum MedKit aqui!");
            return 
1;
        }
    }
    return 
1;

Funcionou... mas se alguem dropar o kit ele nao destroi! e se eu colocar : DestroyObject(kit[i]); ele nao vai funcionar se estiver algum outro dropado!
OsamaBin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] Comando bugado. SukMathcuck Português/Portuguese 20 24/01/2015 02:38 AM
[Ajuda] Comando Bugado! DwarD Português/Portuguese 0 13/11/2014 04:54 PM
[Ajuda] Comando bugado. HumildadeForevis Português/Portuguese 12 21/06/2013 08:06 PM
[Ajuda] Comando Bugado BillieJoe Português/Portuguese 6 11/03/2013 02:00 AM
[Ajuda] Comando bugado Senhor_Azul Português/Portuguese 0 10/11/2012 07:08 AM


All times are GMT. The time now is 01:26 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.