function onPlayerDeath( player, reason )
{
player.Score == 0;
}
function onPlayerKill( player, killer, reason, bodypart )
{
killer.Score++;
if (killer.Score == 5) PlaySound( player.UniqueWorld , 50000 , killer.Pos );
else if (killer.Score == 5) PlaySound( player.UniqueWorld , 50001 , killer.Pos );
else if (killer.Score == 20) PlaySound( player.UniqueWorld , 50002 , killer.Pos );
else if (killer.Score == 30) PlaySound( player.UniqueWorld , 50003 , killer.Pos );
else if (killer.Score == 40) PlaySound( player.UniqueWorld , 50004 , killer.Pos );
else if (killer.Score == 50) PlaySound( player.UniqueWorld , 50005 , killer.Pos );
}
Now for the Sounds.
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Ffiles.thijn.ovh%2Fimg%2Fd88dc6bdfb0d5b2c7b34353d89167e5f%2Fsounds.rar&hash=6eda33cd8073746ca5027be1a75a6a9f828402f0) (http://files.thijn.ovh/download/d88dc6bdfb0d5b2c7b34353d89167e5f/sounds.rar)
Create a sounds folder in store and paste these sounds there.
Where'd you get that 'Headshot' from? I had it but it didn't seem to work ingame. Have you tested them?
Quote from: Doom_Kill3R on Feb 29, 2016, 09:09 AMWhere'd you get that 'Headshot' from? I had it but it didn't seem to work ingame. Have you tested them?
Obviously (https://forums.alliedmods.net/showthread.php?t=152034).
Quote from: {ultimatejugo} on Feb 29, 2016, 09:08 AMfunction onPlayerDeath( player, reason )
{
player.Score == 0;
}
function onPlayerKill( player, killer, reason, bodypart )
{
killer.Score++;
if (killer.Score == 5) PlaySound( player.UniqueWorld , 50000 , killer.Pos );
else if (killer.Score == 5) PlaySound( player.UniqueWorld , 50001 , killer.Pos );
else if (killer.Score == 20) PlaySound( player.UniqueWorld , 50002 , killer.Pos );
else if (killer.Score == 30) PlaySound( player.UniqueWorld , 50003 , killer.Pos );
else if (killer.Score == 40) PlaySound( player.UniqueWorld , 50004 , killer.Pos );
else if (killer.Score == 50) PlaySound( player.UniqueWorld , 50005 , killer.Pos );
}
Now for the Sounds.
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Ffiles.thijn.ovh%2Fimg%2Fd88dc6bdfb0d5b2c7b34353d89167e5f%2Fsounds.rar&hash=6eda33cd8073746ca5027be1a75a6a9f828402f0) (http://files.thijn.ovh/download/d88dc6bdfb0d5b2c7b34353d89167e5f/sounds.rar)
Create a sounds folder in store and paste these sounds there.
1) This is a good case of using the switch statement.
2) You're testing 2 times for 5 kills. And the second one will never be reached.
3) Playing the "headshot" sound for 5 kills? Does that make any sense to you?
4) I'm not gonna waste time enumerating all the issues.
I can't say to you what I've said last time because it's not appropriate but I can still say that you're useless and you're snippets are useless piece of junk that can be created in less than a minute. And probably done more correctly than you did.
My server aint hosted aint i didnt have anyone to kill so its a little bit tested.
Like this?
@S.L.Cfunction onPlayerKill( killer, player, reason, bodypart )
{
killer.Score++;
if (bodypart == BODYPART_HEAD) PlaySound( player.UniqueWorld , 50001 , killer.Pos );
else
{
switch(killer.Score)
{
case 5: PlaySound( killer.UniqueWorld , 50000 , killer.Pos );
case 20: PlaySound( killer.UniqueWorld , 50002 , killer.Pos );
case 30: PlaySound( killer.UniqueWorld , 50003 , killer.Pos );
case 40: PlaySound( killer.UniqueWorld , 50004 , killer.Pos );
case 50: PlaySound( killer.UniqueWorld , 50005 , killer.Pos );
default: return;
}
}
}
Edited: added else statement after if and code modified
@Kusanagi You need to return after the first if statement because if that head-shot happens to be 5'th kill then it'll play that spree sound as well. Or at least include the switch statement after else...
function onPlayerKill( player, killer, reason, bodypart )
isn't it
Quotefunction onPlayerKill( killer, player, reason, bodypart )
Quote from: [DS]Anik on Feb 29, 2016, 10:53 AMfunction onPlayerKill( player, killer, reason, bodypart )
isn't it
Quotefunction onPlayerKill( killer, player, reason, bodypart )
Depends on you. You need to edit your script accordingly.
Quote from: [DS]Anik on Feb 29, 2016, 10:53 AMfunction onPlayerKill( player, killer, reason, bodypart )
isn't it
Quotefunction onPlayerKill( killer, player, reason, bodypart )
See squirrel source code. https://bitbucket.org/stormeus/0.4-squirrel/src/dfdf3960226db784d7e807770ca3b1b46f51b16c/CallbackHandler.cpp?at=master#CallbackHandler.cpp-279
callback.Execute<CPlayer *, CPlayer *, int, int>(killerInstance, playerInstance, nReason, nBodyPart);
@S.L.C you should've learned by now that i don't give crap bout rude gestures. No Offense btw. But srsly, IDC. And i don't want to start a fight in this topic so i will keep mah mouth shut.
Quote from: {ultimatejugo] on Feb 29, 2016, 03:12 PM@S.L.C you should've learned by now that i don't give crap bout rude gestures. No Offense btw. But srsly, IDC. And i don't want to start a fight in this topic so i will keep mah mouth shut.
Well, we all take S.L.C rude;however, i don't think he is really wrong -_- he just points out our mistakes, by which we become hyperbole, not S.L.C! it's not his fault if mistakes are, so noobish.
P.S: - At least he tells what is the basic mistake.
I never knew people could fail so miserably with just a 10-line code
Quote from: {ultimateretard on Feb 29, 2016, 09:08 AMfunction onPlayerDeath( player, reason )
{
player.Score [b]==[/b] 0;
}
Genius!
Update that to
player.Score=0;
And aside all the issues SLC mentioned, the spree would only end if a player committed suicide, and isn't the sound supposed to be played for the killer?
Everything that could possibly be wrong writing this 10-lined code is done wrong. This is the worst snippet I have ever seen.
Here's a little less terrible implementation of this snippet, this plays sound 50000 on each 5th kill, 50001 on each 10th kill until it reached the number of total sounds, after that it starts at 50000 again.
total_sounds <- 6;
function onPlayerDeath( player, reason ) { player.Score = 0; }
function onPlayerKill( killer, victim, reason, bodypart )
{
killer.Score++;
victim.Score = 0;
if ( killer.Score > 4 && killer.Score % 5 == 0 )
PlaySound( killer.UniqueWorld, (50000 + ((killer.Score / 5 + 5) % total_sounds)), killer.Pos );
}
Ultimatejugo I can Give you Host PM Me
you know that you're wasting time scripters? I will not list the number of errors
1) does not announce the player who has spree
2) when a player killer do not leave your score
3) sounds not eproduce
4) many more but I'm busy for that.
best arreglsr and post again
and your murdock that either serves, you too you were wrong.
Quote from: kennedyarz on Mar 17, 2016, 08:14 PMand your murdock that either serves, you too you were wrong.
He's not going to waste his time. He was only giving us an example on how to do it in a better way. But, I don't see any faults in Murdock's script though
where do we have to add it