Author Topic: Events: nuthin' doin'  (Read 532 times)

I'm in a bit of a pickle.

Code: [Select]
function GameConnection::upgradeSponsor(%client,%csponsor)
{
echo("got upgrade request");
if(%client.credits >= $uprgadeCost[%csponsor,%client.sponsor[%csponsor]])
{
if(%client.sponsor[%csponsor] != $maxSponsorLevel[%csponsor])
{
%client.sponsor[%csponsor]++;
messageClient(%client,'',"\c6Thank you for your investment!");
}
else
{
messageClient(%client,'',"\c6You already have all the available sponsorship from this company!");
}
}
else
{
messageClient(%client,'',"\c6Insufficient funds!");
}
}

function GameConnection::addWeapons(%client)
{
for(%i = 0; i < 5; i++)
{
%slotTempItem[%i] = getSponsorWeapon(%client, %client.inventorySlot[%i]);
%client.player.tool[%i]=%slotTempItem[%i].getID();
messageClient(%client,'MsgItemPickup','',%i,%slotTempItem[%i].getID());
}
}

Code: [Select]
registerOutputEvent(GameConnection,upgradeSponsor,"list Eventis 0 Maelstrom 1 Control 2 Aeon 3 Galaxy 4 Tsotoshi 5 Remington 6");
registerOutputEvent(GameConnection,addWeapons,"");

Neither of these do ANYTHING, not even a syntax error. Halp?

Code: [Select]
function GameConnection::upgradeSponsor(%client,%csponsor)
{
echo("got upgrade request");
if(%client.credits >= $uprgadeCost[%csponsor,%client.sponsor[%csponsor]])
{
if(%client.sponsor[%csponsor] != $maxSponsorLevel[%csponsor])
{
%client.sponsor[%csponsor]++;
messageClient(%client,'',"\c6Thank you for your investment!");
}
else
{
messageClient(%client,'',"\c6You already have all the available sponsorship from this company!");
}
}
else
{
messageClient(%client,'',"\c6Insufficient funds!");
}
}

function GameConnection::addWeapons(%client)
{
>>>>>>>>for(%i = 0; i < 5; i++)<<<<<<,
{
%slotTempItem[%i] = getSponsorWeapon(%client, %client.inventorySlot[%i]);
%client.player.tool[%i]=%slotTempItem[%i].getID();
messageClient(%client,'MsgItemPickup','',%i,%slotTempItem[%i].getID());
}
}




 the for %i is missing a %
« Last Edit: December 19, 2009, 01:10:39 PM by Human Reaper »

the for %i is missing a % also I would use .getBl_id not .getid

Thanks for the %i, but what the hell? .getID gets the ID of a datablock, not used for clients...

Are you sure you know enough torque script to be answering scripting questions?

Sorry, I was think of players id lol. Ya I know what .getid is used for I used it in one of my scripts.