12.08.2014, 17:35
Quote:
Well in that line you do insert hitid in the MinigunInfo array although it is the objectid
pawn Код:
pawn Код:
pawn Код:
|
Here's the full code;
http://pastebin.com/JijHbQqL
I create the minigun like this;
pawn Код:
CMD:createminigun(playerid, params[]) {
if(IsPlayerAdmin(playerid))
{
if(Miniguns < MAX_MINIGUNS)
{
new health, Float:damage, Float:range;
if(sscanf(params, "iff", health, damage, range)) return SendClientMessage(playerid, COLOR_NOTES, "[USAGE] /createminigun HEALTH DAMAGE RANGE");
if(health > 100 || health < 45) return SendClientMessage(playerid, COLOR_NOTES, "[INFO] The max. HEALTH is 100, the min. HEALTH is 45.");
else if(damage > 20 || damage < 5) return SendClientMessage(playerid, COLOR_NOTES, "[INFO] The max. DAMAGE is 20, the min. DAMAGE is 5.");
else if(range > 35 || range < 10) return SendClientMessage(playerid, COLOR_NOTES, "[INFO] The max. RANGE is 35, the min. RANGE is 10.");
new Float:X, Float:Y, Float:Z, Float:Angle; GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, Angle);
new id = GetAvailableID();
CreateMinigun(playerid, id, X, Y, Z, Angle, health, damage, range);
//Remove these 4 lines ( 594 -> 597 ), if you don't want people to get notifications about miniguns being created.
new string[72];
format(string, sizeof(string), "[INFO] %s(%d) has created a minigun at %s.", GetName(playerid), playerid, GetPlayerArea(playerid));
SendClientMessageToAll(COLOR_RED, string), string = "\0";
}
else SendClientMessage(playerid, COLOR_RED, "[NOTE] The max. amount of miniguns has been reached.");
}
else return 0;
return 1;
}
stock CreateMinigun(Creator, mID, Float:X, Float:Y, Float:Z, Float:Angle, Health, Float:Damage, Float:Range)
{
new lString[124];
MinigunInfo[mID][Object] = CreateObject(2985,X,Y+1,Z-0.95,0,0,0);
MinigunInfo[mID][ID] = mID;
MinigunInfo[mID][CreatorID] = Creator;
MinigunInfo[mID][IsSpawned] = 1;
MinigunInfo[mID][MinigunHealth] = Health;
MinigunInfo[mID][MinigunDamage] = Damage, MinigunInfo[mID][MinigunRange] = Range;
MinigunInfo[mID][mX] = X, MinigunInfo[mID][mY] = Y+1, MinigunInfo[mID][mZ] = Z-0.75, MinigunInfo[mID][mAngle] = Angle;
Miniguns++;
printf("[info] created minigun %d .. %d", mID, Miniguns);
printf("[info] creator: %d, health: %d, dmg: %0.1f, rng: %0.1f.", Creator, Health, Damage, Range);
format(lString, sizeof(lString), "{FFFFFF}%s's {64CC66}minigun(ID: %d)\n{FFFFFF}Deals {64CC66}%0.1f damage\n{FFFFFF}Has {64CC66}%d health left.", GetName(Creator), mID, Damage, Health);
MinigunInfo[mID][Label] = CreateDynamic3DTextLabel(lString, -1, X,Y+1,Z, 60);
return 1;
}