Author Topic: Question(s)  (Read 1479 times)

Thanks a lot. There's only one problem now; it gives me the gun image, shows that I have it in slot 4, but it doesn't let me use it. If I scroll down from printer, it shows that I have a printer. If I press q while in slot 4, it doesn't show any item.
I made a derp.

Replace all instances of %player with %obj.

I made a derp.

Replace all instances of %player with %obj.
yeah, i fixed it on the plane

thanks anyways.

actually, one last question. I'm attempting to make a save/load process, but to no avail. when I'm doing it, I'm using a global variable such as the ones that I was using before. Would this be a good way to go about this or would it be better to make a file in like, config? I've had no good experiences with files before and can't seem to get them working.

Code: [Select]
function SaveLoadout(%c) {
if(!isObject(%c)) {
messageClient(%c,'',"\c3You cannot save current loadout - you do not have a client!");
return;
} else {
%maxtools=%c.player.getDatablock().MaxTools;
for(%i=0;%i<%maxTools;%i++) {
$GunMod::Loadout[%c.getBLID] = $GunMod::Loadout[%c.getBLID] + %c.player.tool[%i].getname();
}
}
}

function LoadLoadout(%c) {
%p=%c.player;
%maxtools = %p.getDatablock().maxtools;
if(getWordCount($GunMod::Loadout[%c.getBLID]) > %maxtools) {
messageClient(%c,'',"\c3Your tool loadout has too many tools for your current inventory.");
} else {
for(%i=0;%i<getwordcount($GunMod::Loadout[%c.getBLID]);%i++) {
%player.tool[%i]="";
%player.weaponcount--;
%tool = getWord($GunMod::Loadout[%c.getBLID],%i);
%player.tool[%i] = %tool.getID;
%player.weaponcount++;
messageClient(%c,'MsgItemPickup','',%i,%tool);
}
}
}
is the code. I don't know why, but it's saving as $GunMod::Loadout[%c.getBLID] instead of a BLID.. would it be taking this literally? It also saves that variable as 0, and I don't know why.

is the code. I don't know why, but it's saving as $GunMod::Loadout[%c.getBLID] instead of a BLID.. would it be taking this literally? It also saves that variable as 0, and I don't know why.
find out what %c.getBLID is supposed to do and you'll have your answer.

I suspect getBLID is a function, but you wrote it like a variable, so its not working
it could also be %c has no value.

echo() is your friend for stuff like this

find out what %c.getBLID is supposed to do and you'll have your answer.

I suspect getBLID is a function, but you wrote it like a variable, so its not working
it could also be %c has no value.

echo() is your friend for stuff like this
i did echo this. .getblid works for clients, it's also defined, i've tried those already. gonna try replacing %c.getblid with %id = %c.getblid and then [%id]... i dunno if it'll fix it, but it's worth a try.

Why not just use .bl_id ?

Also %player.tool[%i] = %tool.getID;
to
%player.tool[%i] = %tool.getID();

It's a function.

Why not just use .bl_id ?

Also %player.tool[%i] = %tool.getID;
to
%player.tool[%i] = %tool.getID();

It's a function.
thanks for the fix.
.bl_id returns the client's blid?

also i'm a handicap, i used %player in the last function instead of %p :c

but that's not even the issue at hand, right now it's screwing up due to the fact that it won't save.

thanks for the fix.
.bl_id returns the client's blid?

try it and find out....

in the console enter:
echo( findclientbyname("your name").bl_id );


remember:  echo() is your friend

try it and find out....

in the console enter:
echo( findclientbyname("your name").bl_id );


remember:  echo() is your friend

already got that...
but that's not even the issue at hand, right now it's screwing up due to the fact that it won't save.

I like how if the client doesn't exist, you attempt to message it :).

Change:
Code: [Select]
$GunMod::Loadout[%c.getBLID] = $GunMod::Loadout[%c.getBLID] + %c.player.tool[%i].getname();to
Code: [Select]
$GunMod::Loadout[%c.getBLID] = $GunMod::Loadout[%c.getBLID] SPC %c.player.tool[%i].getName();
And
Code: [Select]
%player.tool[%i] = %tool.getID;to
Code: [Select]
%player.tool[%i] = %tool.getID();

I like how if the client doesn't exist, you attempt to message it :).

Change:
Code: [Select]
$GunMod::Loadout[%c.getBLID] = $GunMod::Loadout[%c.getBLID] + %c.player.tool[%i].getname();to
Code: [Select]
$GunMod::Loadout[%c.getBLID] = $GunMod::Loadout[%c.getBLID] SPC %c.player.tool[%i].getName();
And
Code: [Select]
%player.tool[%i] = %tool.getID;to
Code: [Select]
%player.tool[%i] = %tool.getID();
oops, meant %c.player, fixed
and thanks. i'll test it later.