Growing drugs system not defining ID's
#1

Hi guys,
I have a little problem here. I made some sort of planting drugs and harvesting system. Problem is it doesnt store the coordinates of the plants in its ID. What i wanted is when the player planted the drug it gave the drug the lowest ID avaiable and stored its position on that id. I tried to do it but what really is happening is when i plant a new drug its almost like if the last one was deleted but the object is still there, but position is not detected after that. Here's the code:

PHP код:
enum drogasinfo
{
    
drogasbush,
    
Float:drogasx,
    
Float:drogasy,
    
Float:drogasz,
    
drogasid,
    
drogascolher,
};
new 
DrugInfo[50][drogasinfo]; 
PHP код:
if(strcmp(cmd,"/sementes"true) == 0)
        {
            new 
x_nr[256];
            
x_nr strtok(cmdtextidx);
            if(!
strlen(x_nr)) {
                
SendClientMessage(playeridCOLOR_LIGHTRED,"{ADFF2F}[Comando]: {FFFFFF} /sementes [Comandos]");
                
SendClientMessage(playeridCOLOR_LIGHTRED,"{ADFF2F}[Comando]: {FFFFFF} plantar, colher");
                return 
1;
            }
            if(
strcmp(x_nr,"plantar",true) == 0)
            {
                if(
IsPlayerConnected(playerid))
                {
                    if(
PlayerInfo[playerid][pFaction] == || PlayerInfo[playerid][pFaction] == 8)
                    {
                        if(
PlayerInfo[playerid][pSementes] > 0)
                        {
                            for(new 
0sizeof(DrugInfo); b++)
                            {
                                new 
Float:x;
                                new 
Float:y;
                                new 
Float:z;
                                
ApplyAnimation(playerid"BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
                                
ApplyAnimation(playerid"BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
                                
GetPlayerPos(playeridxyz);
                                
DrugInfo[b][drogasbush] = CreateDynamicObject(809xyz-1.00000);
                                
DrugInfo[b][drogasx] = x;
                                
DrugInfo[b][drogasy] = y;
                                
DrugInfo[b][drogasz] = z;
                                
DrugInfo[b][drogascolher] = 0;
                                
PlayerInfo[playerid][pSementes] -= 1;
                                
SetTimerEx("crescer"10000false"ii"playeridb);
                                
SendClientMessage(playeridCOLOR_WHITE"[Info] Plantas-te uma semente de cocaina. Terбs que esperar algum tempo antes de a colher.");
                                return 
1;
                            }
                        }
                        else
                        {
                        
SendClientMessage(playeridCOLOR_RED"[Erro]: Nao tens sementes suficientes!");
                        return 
1;
                        }
                    }
                    else
                    {
                    
SendClientMessage(playeridCOLOR_RED"[Erro]: Nao pertences а faction que trafica drogas");
                    return 
1;
                    }
                }
            }
            else if(
strcmp(x_nr,"colher",true) == 0)
            {
                if(
PlayerInfo[playerid][pFaction] == || PlayerInfo[playerid][pFaction] == 8)
                {
                        for(new 
0sizeof(DrugInfo); b++)
                           {
                               if(
IsPlayerInRangeOfPoint(playerid3.0DrugInfo[b][drogasx], DrugInfo[b][drogasy], DrugInfo[b][drogasz]))
                            {
                                if(
DrugInfo[b][drogascolher] == 1)
                                {
                                    
ApplyAnimation(playerid"BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
                                    
DrugInfo[b][drogascolher] = 0;
                                    
DestroyDynamicObject(DrugInfo[b][drogasbush]);
                                    
DrugsHolding[playerid] += 5;
                                    
SendClientMessage(playeridCOLOR_WHITE"[Info]: Colheste a tua planta. Agora para a transformares tens que a entregar ao teu trabalhador.");
                                    return 
1;
                                }
                                else
                                {
                                
SendClientMessage(playeridCOLOR_RED"[Erro]: A planta ainda nao cresceu! Espera mais tempo.");
                                return 
1;
                                }
                            
                            }
                            else
                            {
                            
SendClientMessage(playeridCOLOR_RED"[Erro]: Nao estas perto de nenhuma planta de cocaina!");
                            return 
1;
                            }
                        }
                    
                }
                else
                {
                
SendClientMessage(playeridCOLOR_RED"[Erro]: Nao pertences a faction que vende drogas!");
                return 
1;
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_RED,"{FF0000}[Erro]: {FFFFFF}Comando Invalido.");
                return 
1;
            }
            return 
1;
        } 
PHP код:
forward crescer(playeridc);
public 
crescer(playeridc)
{
    
DrugInfo[c][drogascolher] = 1;

Please help me guys. i would apreciate if someone could help me +REP
Reply
#2

Quote:
Originally Posted by GunZsmd
Посмотреть сообщение
Hi guys,
I have a little problem here. I made some sort of planting drugs and harvesting system. Problem is it doesnt store the coordinates of the plants in its ID. What i wanted is when the player planted the drug it gave the drug the lowest ID avaiable and stored its position on that id. I tried to do it but what really is happening is when i plant a new drug its almost like if the last one was deleted but the object is still there, but position is not detected after that.
Alright, I will try to help you but firstly explain me what do you mean : "i wanted is when the player planted the drug it gave the drug the lowest ID avaiable"
If you plant drugs, an object appears and you want the object's ID. With this ID, you want save the coordinates of the plant ?
Check mine /obj.

PHP код:
//------------------------------------------------------------------------------------------------
// ==============================================================================================
//                                  973 - 978 - 979
// ==============================================================================================
//------------------------------------------------------------------------------------------------
new objj;
new 
objectIDD[MAX_OBJECTS];
CMD:obj(playeridparams[]) // Appears an object (Model required)
{
    if(
PlayerInfo[playerid][pAdminlvl] == && PlayerGod[playerid] == 2)
    {
        new 
Float:xFloat:yFloat:zFloat:zRobstr[99];
        if(
sscanf(params,"i"ob))
        {
            
SendClientMessage(playeridX11_LIGHT_BLUE_1"/obj [object_id]");
            return 
SendClientMessage(playeridX11_LIGHT_BLUE_1"Object ID conseillй : 973 - 978 - 979");
        }
        
GetPlayerPos(playeridx,y,z);
        
GetPlayerFacingAngle(playeridzR);
        
objectIDD[objj++] = CreateObject(obxyz00zR);
        
format(strsizeof(str), "[DEBUG] Object ID:"rougeUC" %i"blancU" - ID: "rougeUC"%i"obobjj-1);
        
SendClientMessage(playerid, -1str);
        return 
1;
    }
    else return 
SendClientMessage(playeridred"[SYSTEM]"rougeUC" Vous n'кtes pas autorisй а utiliser cette commande.");
}
//------------------------------------------------------------------------------------------------
CMD:des(playeridparams[]) // Destroy the  object (ID requiered)
{
    if(
PlayerInfo[playerid][pAdminlvl] == && PlayerGod[playerid] == 2)
    {
        new 
str[99];
        if(
sscanf(params,"i"objj)) return SendClientMessage(playeridX11_LIGHT_BLUE_1"/des [object_id]");
          
DestroyObject(objectIDD[objj]);
        
format(strsizeof(str), "[DEBUG] Object ID:"rougeUC" %i"blancU" dйtruit!"objj);
        
SendClientMessage(playerid, -1str);
        
objectIDD[objj--];
        return 
1;
    }
    else return 
SendClientMessage(playeridred"[SYSTEM]"rougeUC" Vous n'кtes pas autorisй а utiliser cette commande.");
}
//------------------------------------------------------------------------------------------------ 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)