Having some problems while developing a pick/drop system:
#1

Hello,

I'm trying to develop a pick/drop (drug) system.

I currently have these in my game-mode:
PHP код:
CMD:dropweedplayeridcmdtext[] ) {
    new 
Float:x,
        
Floaty,
        
Float:z,
        
amount,
        
model;
    
GetPlayerPos(playeridxyz);
    if(
sscanf(cmdtext"dd"modelamount))
        return 
SendClientMessage(playerid, -1"USAGE: /dropweed [model] [amount]");
    
CreateDrug(modelamountxyz);
    return 
1;
}
CMD:pickup playeridcmdtext[] ) {
    
PickupDrug(playerid);
    return 
1;
}
stock CreateDrug(DModelDAmountFloat:DXFloat:DYFloat:DZ) {
        for(new 
0sizeof(dInfo); i++) {
        
            if(
dInfo[i][X] == 0.0 && dInfo[i][Y] == 0.0 && dInfo[i][Z] == 0.0) {
            
                
dInfo[i][Model] = DModel;
                
dInfo[i][Amount] = DAmount;
                
dInfo[i][X] = DX;
                
dInfo[i][Y] = DY;
                
dInfo[i][Z] = DZ;
                
DrugObject[i] = CreateDynamicObject(DModelDXDYDZ 0.90.00.00.0, -1, -1, -150.050.0);
                return 
1;
            }
        }
        return 
1;
}
forward PickupDrug(playerid);
public 
PickupDrug(playerid){
    new 
zString[128];
    for(new 
0sizeof(dInfo); i++) {
    
        if(
IsPlayerInRangeOfPoint(playerid2.0dInfo[i][X], dInfo[i][Y], dInfo[i][Z])) {
            
dInfo[i][X] = 0.0;
            
dInfo[i][Y] = 0.0;
            
dInfo[i][Z] = 0.0;
            
dInfo[i][Amount] = 0;
            if(
dInfo[i][Model] == 1578) {
            
                
format(zStringsizeof(zString), "You picked up %d grams of weed."dInfo[i][Amount]);
                
SendClientMessage(playerid, -1zString);
                
pInfo[playerid][Weed] += dInfo[i][Amount];
                
DestroyDynamicObject(DrugObject[i]);
            }
            return 
1;
        }
    }
    return 
1;

My problem is that I go in game, I do /dropweed 1578 (model) 59 (amount) and I believe the object does create but I can't see it at all and when I do /pickup it says I picked up 0 grams of Weed and then the object disappears because if I do /pickup on the same spot it won't tell me again that I picked up 0 grams.

At first, it would create a invisible object and I don't remember what I modified and now it doesn't appear at all.

Is there any way of doing this much easier and more reliable?

Thank you!
Reply


Messages In This Thread
[FIXED] Having some problems while developing a pick/drop system: - by zork - 25.03.2015, 15:23
Re: Having some problems while developing a pick/drop system: - by Aly - 25.03.2015, 15:25
Re: Having some problems while developing a pick/drop system: - by zork - 25.03.2015, 15:29
Re: Having some problems while developing a pick/drop system: - by Aly - 25.03.2015, 16:03
Re: Having some problems while developing a pick/drop system: - by zork - 25.03.2015, 16:09

Forum Jump:


Users browsing this thread: 1 Guest(s)