Author Topic: Item Dropping.  (Read 2388 times)

What's a code to make somebody drop something?

serverCmdDropTool(%client,%slot)

Doesn't that not have a %slot value and just drops your current tool?

serverCmdDropTool(%client,%slot)
What's your avatar?
A guy putting his arm on the ground?
Or a guy taking a massive stuff?

EDIT:
Code: [Select]
So this is the start?
function DropItemProjectile::DropTool(%client,%slot)
{
      %slot.
      {
            %client.
      }
}
« Last Edit: April 15, 2010, 07:36:40 PM by Butler »

Code: [Select]
So this is the start?
function DropItemProjectile::DropTool(%client,%slot)
{
      %slot.
      {
            %client.
      }
}
Where the hell did you learn to code?

Where the hell did you learn to code?

I didn't...?
Can you fix it then..

What exactly are you trying to do?

Im trying to make it so that when a player is shot, it drops their current weapon.

Code: [Select]
servercmdmyfunction()
{
%client = findclientbyname("yourname");
serverCmdDropTool(%client,1);
}

I think that'd make a function called myfunction that when you called it it'd make a person named yourname drop the item in his slot one.

Code: [Select]
servercmdmyfunction()
{
%client = findclientbyname("yourname");
serverCmdDropTool(%client,1);
}

I think that'd make a function called myfunction that when you called it it'd make a person named yourname drop the item in his slot one.

This would syntax error at line 1 and do nothing. I don't mean to offend you but please don't post in coding help if you can't code.

Edit for clarification: Functions start off as
Code: [Select]
function [whatever it is here] example:
Code: [Select]
function doStuff(arguments here) or
Code: [Select]
function servercmddoStuff(arguments here)

You also don't need to define %client as it is already defined.
-clientsidedstuffsnip-
Been doing too much clientsided scripting, see Amade's post for correct syntax of forcing a server command.
« Last Edit: April 16, 2010, 05:25:42 PM by SpreadsPlague »

Code: [Select]
servercmdmyfunction()
{
%client = findclientbyname("yourname");
serverCmdDropTool(%client,1);
}

I think that'd make a function called myfunction that when you called it it'd make a person named yourname drop the item in his slot one.
What this guy said:
This would syntax error at line 1 and do nothing. I don't mean to offend you but please don't post in coding help if you can't code.
Because you need to define that it's a function.
Code: [Select]
function servercmdmyfunction()

Edit for clarification: You don't need to define %client as it is already defined, also line 4 should read "commandtoserver('droptool');" (is /droptool a command? I don't know lol)
Yeah, basically.  EDIT: Oh wait, this isn't a client-sided script. So you don't use commandToServer()... I think :S (edited the script)
Code: [Select]
function serverCmdDropStuff(%client)
{
 serverCmdDropTool(%client);
 messageClient(%client, '', "\c6You dropped stuff!");
}
« Last Edit: April 16, 2010, 05:25:15 PM by HellsHero »

Code: [Select]
function serverCmdDropStuff(%client)
{
 commandToServer(%client, "droptool");
 messageClient(%client, '', "\c6You dropped stuff!");
}
commandToServer is a client-sided function. The server-sided method for forcing a servercommand is like so:
serverCmdCOMMAND(%client, %arg1, %arg2, %arg3...);

commandToServer is a client-sided function. The server-sided method for forcing a servercommand is like so:
serverCmdCOMMAND(%client, %arg1, %arg2, %arg3...);
Is what I said in my second-edit. :V

Code: [Select]
function DropItemProjectile::damage(%this,%obj,%col,%fade,%pos,%normal)
{
if(isObject(%col.client))
{
serverCmdDropTool(%col.client);
}
}

Or you could make the player drop all their items:

Code: [Select]
function serverCmdDropAllTools(%client,%target)
{
%targetClient = findClientByName(%target);
if(isObject(%targetClient.player))
{
for(%i=0;%i<%targetClient.player.getDatablock().maxTools;%i++)
{
serverCmdDropTool(%targetClient,%i);
}
}
}
[/s]

Ignore this post

It's untested.
« Last Edit: April 16, 2010, 11:26:27 PM by Jaydee »