25.03.2015, 15:23
(
Последний раз редактировалось zork; 25.03.2015 в 16:10.
)
Hello,
I'm trying to develop a pick/drop (drug) system.
I currently have these in my game-mode:
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!
I'm trying to develop a pick/drop (drug) system.
I currently have these in my game-mode:
PHP код:
CMD:dropweed( playerid, cmdtext[] ) {
new Float:x,
Float: y,
Float:z,
amount,
model;
GetPlayerPos(playerid, x, y, z);
if(sscanf(cmdtext, "dd", model, amount))
return SendClientMessage(playerid, -1, "USAGE: /dropweed [model] [amount]");
CreateDrug(model, amount, x, y, z);
return 1;
}
CMD:pickup ( playerid, cmdtext[] ) {
PickupDrug(playerid);
return 1;
}
stock CreateDrug(DModel, DAmount, Float:DX, Float:DY, Float:DZ) {
for(new i = 0; i < sizeof(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(DModel, DX, DY, DZ - 0.9, 0.0, 0.0, 0.0, -1, -1, -1, 50.0, 50.0);
return 1;
}
}
return 1;
}
forward PickupDrug(playerid);
public PickupDrug(playerid){
new zString[128];
for(new i = 0; i < sizeof(dInfo); i++) {
if(IsPlayerInRangeOfPoint(playerid, 2.0, dInfo[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(zString, sizeof(zString), "You picked up %d grams of weed.", dInfo[i][Amount]);
SendClientMessage(playerid, -1, zString);
pInfo[playerid][Weed] += dInfo[i][Amount];
DestroyDynamicObject(DrugObject[i]);
}
return 1;
}
}
return 1;
}
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!