Author Topic: help  (Read 3152 times)

[RU]Kewun

  • Full Member
  • ***
  • Posts: 124
  • Karma: +11/-21
  • C.R.C Marshal
    • View Profile
help
« on: October 03, 2014, 09:13:11 pm »
How i can make if player kill player the death player drops weapon pickup?
like in gta 3 single player if you shoot cop he drops a pistol
how can i do that?
Fear the wrath of god!


Vortrex

  • Full Member
  • ***
  • Posts: 267
  • Karma: +54/-74
    • View Profile
Re: help
« Reply #1 on: October 03, 2014, 10:53:47 pm »
I wrote this up real quick. I don't have time at the moment to test it, but it should work.

Code: [Select]
function onPlayerDeath( player , reason )
{
local model = 0;
switch( player.Weapon )
{
case 1:
model = 172;
break;

case 2:
model = 173;
break;

case 3:
model = 178;
break;

case 4:
model = 176;
break;

case 5:
model = 171;
break;

case 6:
model = 180;
break;

case 7:
model = 177;
break;

case 8:
model = 175;
break;

case 9:
model = 181;
break;

case 10:
model = 174;
break;

case 11:
model = 170;
break;
}

if( model != 0 )
{
local pickup = CreatePickup( model , player.Pos );
if( pickup )
{
pickup.OneTime = true;
}
}
}

function onPickupPickedUp( player , pickup )
{
local weapon = 0;
switch( pickup.Model )
{
case 172:
weapon = 1;
break;

case 173:
weapon = 2;
break;

case 178:
weapon = 3;
break;

case 176:
weapon = 4;
break;

case 171:
weapon = 5;
break;

case 180:
weapon = 6;
break;

case 177:
weapon = 7;
break;

case 175:
weapon = 8;
break;

case 181:
weapon = 9;
break;

case 174:
weapon = 10;
break;

case 175:
weapon = 11;
break;
}

if( weapon != 0 )
{
// I put 999999 ammo due to the Player.WeaponAmmo bug.
player.SetWeapon( weapon , 999999);
}
}

[RU]Kewun

  • Full Member
  • ***
  • Posts: 124
  • Karma: +11/-21
  • C.R.C Marshal
    • View Profile
Re: help
« Reply #2 on: October 04, 2014, 08:02:21 am »
doesnt work
Fear the wrath of god!


Vortrex

  • Full Member
  • ***
  • Posts: 267
  • Karma: +54/-74
    • View Profile
Re: help
« Reply #3 on: October 04, 2014, 01:17:24 pm »
Then fix it. I only supplied that code snippet as an example of how it could work.

EDIT: I just did some testing, and it does work, but it puts the weapon pickup right where the player dies, so he picks it up before the death finishes.

Try this instead:
Code: [Select]
function onPlayerDeath( player , reason )
{
local model = 0;
switch( player.Weapon )
{
case 1:
model = 172;
break;

case 2:
model = 173;
break;

case 3:
model = 178;
break;

case 4:
model = 176;
break;

case 5:
model = 171;
break;

case 6:
model = 180;
break;

case 7:
model = 177;
break;

case 8:
model = 175;
break;

case 9:
model = 181;
break;

case 10:
model = 174;
break;

case 11:
model = 170;
break;
}

if( model != 0 )
{
local pickup = CreatePickup( model , Vector( player.Pos.x + 5 , player.Pos.y , player.Pos.z ) );
if( pickup )
{
pickup.OneTime = true;
}
}
}

function onPickupPickedUp( player , pickup )
{
local weapon = 0;
switch( pickup.Model )
{
case 172:
weapon = 1;
break;

case 173:
weapon = 2;
break;

case 178:
weapon = 3;
break;

case 176:
weapon = 4;
break;

case 171:
weapon = 5;
break;

case 180:
weapon = 6;
break;

case 177:
weapon = 7;
break;

case 175:
weapon = 8;
break;

case 181:
weapon = 9;
break;

case 174:
weapon = 10;
break;

case 175:
weapon = 11;
break;
}

if( weapon != 0 )
{
// I put 999999 ammo due to the Player.WeaponAmmo bug.
player.SetWeapon( weapon , 999999);
}
}
« Last Edit: October 04, 2014, 01:26:47 pm by Vortrex »

[RU]Kewun

  • Full Member
  • ***
  • Posts: 124
  • Karma: +11/-21
  • C.R.C Marshal
    • View Profile
Re: help
« Reply #4 on: October 05, 2014, 04:58:50 pm »
what client ? 0 or 1 because i dont know about client in <scriptfile=lal=and the client that i dont kno w what means
Fear the wrath of god!


Vortrex

  • Full Member
  • ***
  • Posts: 267
  • Karma: +54/-74
    • View Profile
Re: help
« Reply #5 on: October 05, 2014, 06:19:28 pm »
The code snippet I provided is for a server script.

Use client="0" since it's not a client script.

[RU]Kewun

  • Full Member
  • ***
  • Posts: 124
  • Karma: +11/-21
  • C.R.C Marshal
    • View Profile
Re: help
« Reply #6 on: October 07, 2014, 06:45:35 am »
It doesnt work.
i created a .nut and i paste the script in it and then add it to script.xml and then launched server
and if i typed /kill no weapons were dropped..
Fear the wrath of god!


Vortrex

  • Full Member
  • ***
  • Posts: 267
  • Karma: +54/-74
    • View Profile
Re: help
« Reply #7 on: October 07, 2014, 07:12:53 am »
It does work. I tested it myself.

Are you holding a weapon when you die?

[RU]Kewun

  • Full Member
  • ***
  • Posts: 124
  • Karma: +11/-21
  • C.R.C Marshal
    • View Profile
Re: help
« Reply #8 on: October 08, 2014, 03:38:32 pm »
yes,i hold
Fear the wrath of god!


Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: help
« Reply #9 on: October 08, 2014, 08:25:53 pm »
Did you add your script to your content.xml?

[RU]Kewun

  • Full Member
  • ***
  • Posts: 124
  • Karma: +11/-21
  • C.R.C Marshal
    • View Profile
Re: help
« Reply #10 on: October 09, 2014, 04:07:18 pm »
i did this:
created a new folder named scriptzz in scripts folder
i go to content.xml and add this line: <script folder="scriptzz"/>
i created an script.xml in the scriptzz folder
then i did the scriptweaponsfall.nut
i pasted the things in the nut
and then i add the scriptweaponsfall.nut
and i launch srever
i kill my self and weapon doesnt fall..
Fear the wrath of god!


[RU]Kewun

  • Full Member
  • ***
  • Posts: 124
  • Karma: +11/-21
  • C.R.C Marshal
    • View Profile
Re: help
« Reply #11 on: December 22, 2014, 09:18:49 pm »
OK, nvm it works now  ;D
Fear the wrath of god!


 

© Liberty Unleashed Team.