PDA

View Full Version : Symbol is assigned a value that is never used: "ent"


Mandiii
06-12-2010, 18:20
Cant seem to find a way to solve it. :(

loadBlocks(id)
{
new ent;

new bool:bAccess = false;

//if this function was called on map load, ID is 0
if (id == 0)
{
bAccess = true;
}
//make sure user calling this function has access
else if (get_user_flags(id) & BM_ADMIN_LEVEL)
{
bAccess = true;
}

if (bAccess)
{
//if map file exists
if (file_exists(gszNewFile))
{
//if a player is loading then first delete all the old blocks, teleports and timers
if (id > 0 && id <= 32)
{
deleteAllBlocks(id, false);
deleteAllTeleports(id, false);
deleteAllTimers(id, false);
}

new szData[128];
new szType[2];
new sz1[16], sz2[16], sz3[16], sz4[16], sz5[16], sz6[16], sz7[16];
new Float:vVec1[3];
new Float:vVec2[3];
new axis;
new size;
new f = fopen(gszNewFile, "rt");
new blockCount = 0;
new teleCount = 0;
new timerCount = 0;
new bool:bTimerStart = true;
new Float:vTimerOrigin[3];
new Float:vTimerAngles[3];

//iterate through all the lines in the file
while (!feof(f))
{
szType = "";
fgets(f, szData, 128);
parse(szData, szType, 1, sz1, 16, sz2, 16, sz3, 16, sz4, 16, sz5, 16, sz6, 16, sz7, 16);

vVec1[0] = str_to_float(sz1);
vVec1[1] = str_to_float(sz2);
vVec1[2] = str_to_float(sz3);
vVec2[0] = str_to_float(sz4);
vVec2[1] = str_to_float(sz5);
vVec2[2] = str_to_float(sz6);
size = str_to_num(sz7);

if (strlen(szType) > 0)
{
//if type is not a teleport
if (szType[0] != gTeleportSaveId)
{
//set axis orientation depending on block angles
if (vVec2[0] == 90.0 && vVec2[1] == 0.0 && vVec2[2] == 0.0)
{
axis = X;
}
else if (vVec2[0] == 90.0 && vVec2[1] == 0.0 && vVec2[2] == 90.0)
{
axis = Y;
}
else
{
axis = Z;
}

//increment block counter
++blockCount;
}

//create block or teleport depending on type
switch (szType[0])
{
case 'A': ent = createBlock(0, BM_PLATFORM, vVec1, axis, size);
case 'B': ent = createBlock(0, BM_BHOP, vVec1, axis, size);
case 'C': ent = createBlock(0, BM_DAMAGE, vVec1, axis, size);
case 'D': ent = createBlock(0, BM_HEALER, vVec1, axis, size);
case 'E': ent = createBlock(0, BM_INVINCIBILITY, vVec1, axis, size);
case 'F': ent = createBlock(0, BM_STEALTH, vVec1, axis, size);
case 'G': ent = createBlock(0, BM_TRAMPOLINE, vVec1, axis, size);
case 'H': ent = createBlock(0, BM_SPEEDBOOST, vVec1, axis, size);
case 'I': ent = createBlock(0, BM_NOFALLDAMAGE, vVec1, axis, size);
case 'J': ent = createBlock(0, BM_ICE, vVec1, axis, size);
case 'K': ent = createBlock(0, BM_DEATH, vVec1, axis, size);
case 'L': ent = createBlock(0, BM_HE, vVec1, axis, size);
case 'M': ent = createBlock(0, BM_CAMOUFLAGE, vVec1, axis, size);
case 'N': ent = createBlock(0, BM_LOWGRAVITY, vVec1, axis, size);
case 'O': ent = createBlock(0, BM_FIRE, vVec1, axis, size);
case 'P': ent = createBlock(0, BM_SLAP, vVec1, axis, size);
case 'Q': ent = createBlock(0, BM_RANDOM, vVec1, axis, size);
case 'R': ent = createBlock(0, BM_HONEY, vVec1, axis, size);
case 'S': ent = createBlock(0, BM_BARRIER_CT, vVec1, axis, size);
case 'T': ent = createBlock(0, BM_BARRIER_T, vVec1, axis, size);
case 'U': ent = createBlock(0, BM_BOOTSOFSPEED, vVec1, axis, size);
case 'V': ent = createBlock(0, BM_GLASS, vVec1, axis, size);
case 'W': ent = createBlock(0, BM_BHOP_NOSLOW, vVec1, axis, size);
case 'X': ent = createBlock(0, BM_DUCK, vVec1, axis, size);
case 'Y': ent = createBlock(0, BM_ASS, vVec1, axis, size);
case 'Z': ent = createBlock(0, BM_SALTO, vVec1, axis, size);
case '1': ent = createBlock(0, BM_FROST, vVec1, axis, size);
case '2': ent = createBlock(0, BM_FLASH, vVec1, axis, size);
case '3': ent = createBlock(0, BM_DELAYED, vVec1, axis, size);
case '4': ent = createBlock(0, BM_MONEY, vVec1, axis, size);
case '5': ent = createBlock(0, BM_DEAGLE, vVec1, axis, size);
case '6': ent = createBlock(0, BM_AWP, vVec1, axis, size);
case '7': ent = createBlock(0, BM_GRAVITY, vVec1, axis, size);
case '8': ent = createBlock(0, BM_BLIND, vVec1, axis, size);
case '9': ent = createBlock(0, BM_BLINDFAST, vVec1, axis, size);
case 'a': ent = createBlock(0, BM_SG, vVec1, axis, size);
case 'b': ent = createBlock(0, BM_SUPERHEAL, vVec1, axis, size);
case 'c': ent = createBlock(0, BM_SUPERHONEY, vVec1, axis, size);
case 'd': ent = createBlock(0, BM_COLT, vVec1, axis, size);
case 'e': ent = createBlock(0, BM_SUPERMONEY, vVec1 ,axis, size);

case gTeleportSaveId:
{
createTeleport(0, TELEPORT_START, vVec1);
createTeleport(0, TELEPORT_END, vVec2);

//increment teleport count
++teleCount;
}

case gTimerSaveId:
{
//is this the first timer info retrieved from file?
if (bTimerStart)
{
//store start timer info
vTimerOrigin[0] = vVec1[0];
vTimerOrigin[1] = vVec1[1];
vTimerOrigin[2] = vVec1[2];
vTimerAngles[0] = vVec2[0];
vTimerAngles[1] = vVec2[1];
vTimerAngles[2] = vVec2[2];

//the next timer to come along is the end of the timer
bTimerStart = false;
}
else
{
//create the start of timer
createTimer(0, TIMER_START, vTimerOrigin, vTimerAngles);

//create the end of the timer
createTimer(0, TIMER_END, vVec1, vVec2);

//if another timer comes along then it'll be the start again
bTimerStart = true;

//increment timer count
++timerCount;
}
}

default:
{
log_amx("%sInvalid block type: %c in: %s", gszPrefix, szType[0], gszFile);

//decrement block counter because a block was not created
--blockCount;
}
}
}
}

fclose(f);

//if a player is loading the blocks
if (id > 0 && id <= 32)
{
//get players name
new szName[32];
get_user_name(id, szName, 32);

//notify all admins that the player loaded blocks from file
for (new i = 1; i <= 32; ++i)
{
//make sure player is connected
if (is_user_connected(i))
{
if (get_user_flags(i) & BM_ADMIN_LEVEL)
{
client_print(i, print_chat, "%s'%s' loaded %d block%s, %d teleporter%s and %d timer%s! Total entites in map: %d", gszPrefix, szName, blockCount, (blockCount == 1 ? "" : "s"), teleCount, (teleCount == 1 ? "" : "s"), timerCount, (timerCount == 1 ? "" : "s"), entity_count());
}
}
}
}
}
else
{
//if a player is loading the blocks
if (id > 0 && id <= 32)
{
//notify player that the file could not be found
client_print(id, print_chat, "%sCouldn't find file: %s", gszPrefix, gszNewFile);
}
}
}
}

wrecked_
06-12-2010, 21:23
Remove new ent;

and all of the ent ='s before each createBlock().