AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Duels help (https://forums.alliedmods.net/showthread.php?t=276777)

raizo11 12-28-2015 04:41

Duels help
 
fixed

Visinescu 12-28-2015 04:49

Re: Duels help
 
Edited

Kazalu 12-28-2015 04:52

Re: Duels help
 
Hey!

This is more of a request, not a Scripting Help post, but still.

I'm Tattoo's scripter from the knife server. Might've heared about me, mr. Raizo. I know I am not supposed to help you, because of our relationship, but here we go.

I think it would be easier if you'd rewrite the code from the scratch, as it would be a pain in the ass to modify a code that big.

If though you don't want to take this into consideration, I'm gonna give you this information :
In order to respawn a player you're gonna have to use the << spawn( id ) >> function. Sometimes the client gets bugged, so you'll have to use the spawn( id ) func twice. How?

Quote:

set_task( 0.5, "SpawnHim", id );
set_task( 0.7, "SpawnHim", id );
The SpawnHim function should look like that :

Quote:

public SpawnHim( id )
spawn( id );
You will also have to change the players' positions after you move them. How?

Quote:

new Float:Origin[ 3 ];
Origin[ 0 ] = blabla;
Origin[ 1 ] = blabla2;
Origin[ 2 ] = blabla3;

set_pev( id, pev_origin, Origin );
blabla, blabla2, blabla3 are 3 floats which set the x, y and z coordinates of the spawn.

After that, you're gonna have to give players the needed weapons using give_item( id, "weapon_blabla" ).
Check out the weapon codes in order to use give_item.

That's about it.

raizo11 01-13-2016 14:02

Re: Duels help
 
Bump!

addons_zz 01-13-2016 19:15

Re: Duels help
 
Quote:

Originally Posted by raizo11
Can u look my thried and can u say me is possible what I want?

https://forums.alliedmods.net/showthread.php?t=276777

Sure it is possible, the right question is: How much time/Knowledge would take to accomplish it? i.e., to write/modify your code to get it done?

Now, to me get this done, I do not know how much time would take. But my first step would be to get to know that code and learn if it is working correctly. After that, and as I already know the code, I would think about some strategy/algorithm to get it done.

One thing that help me is to debug the code as a way to get to know it. Here I made a tutorial explaining a debugging system I used to build my plugins, see if it helps you.

addons_zz 01-23-2016 01:02

Re: Duels help
 
Quote:

Originally Posted by raizo11
Can you explain more how to make more rounds please

Look at these highlighted code lines. Using these, you can count the wins and rounds, then to create a logic/algorithm to your plugin and force/allow it to control the plugin as you want to: duel ends after one player win with 10-0 or 10-4 or 10-6 variable score ... But 9-0 of 9-4 or 9-9 round not end ... after duel ends respawn players normal. After duel ends get to all message ... Winner name win with [10-9,10-2,10-5] Losser name lose with [9-10 , 2-10, 5-10]

To know how to control your plugin, you must to know how it starts and ends the duel, then you can block it and only allow it to end, when your rules are fit. See these highlighted code lines to have an example about how to block/allow some behavior. To acquire such Knowledge, you can read/debug your code.

raizo11 01-23-2016 09:16

Re: Duels help
 
is difficult for me thank you anyway

addons_zz 01-26-2016 16:14

Re: Duels help
 
1 Attachment(s)
Here you can see what I changed:
https://gist.github.com/addonszz/e2831dd591d6deb4d710/revisions?diff=split

It is done, but last some things to do.

TODO list:
  • block round end, when there is only 2 players.
  • Improve the stop system, beyond 'say /stopduel'
  • Fix the save and read origins system, which is not working.
  • Create a built-in revive system, instead of just use the 'amx_revive' from "amx super" plugin.
  • Remove player weapons after revive.
To finish would take more time, but it already has took one hour, but it should take half, so i stopped.

raizo11 02-24-2016 01:20

Re: Duels help
 
Thanks for you work but
I want to respawn challenger + challenged

Can you make for example :

Code:

public plugin_init()
{
    register_plugin( "duel" , "0.1" , "x" );
   
    RegisterHam( Ham_Killed , "player" , "fw_PlayerKilled_Post" , true ); // Define player (player = challenger + challenged)
}


public fw_PlayerKilled_Post( g_iChallenged  , g_iChallenger ) 
{
    if ( g_iChallenged  == g_iChallenger || !is_user_alive( g_iChallenger) )
        return;

Code:

public duel(id)
{
        switch(challenge[id])
        {
                    case 0:
                    {
                        ExecuteHamB(Ham_CS_RoundRespawn, g_iChallenged)
                        set_pev( g_iChallenged , pev_origin , { 300.0 , -150.0 , -650.0 } );
                        ExecuteHamB(Ham_CS_RoundRespawn, g_iChallenger)
                        set_pev( g_iChallenger , pev_origin , { 50.0 , -150.0 , -650.0 } );
                }
                case 1:
                {
                        ExecuteHamB(Ham_CS_RoundRespawn, g_iChallenged)
                        set_pev( g_iChallenged , pev_origin , { 300.0 , -150.0 , -650.0 } );
                        ExecuteHamB(Ham_CS_RoundRespawn, g_iChallenger)
                        set_pev( g_iChallenger , pev_origin , { 50.0 , -150.0 , -650.0 } );
                }
                case 2:
                {
                        ExecuteHamB(Ham_CS_RoundRespawn, g_iChallenged)
                        set_pev( g_iChallenged , pev_origin , { 300.0 , -150.0 , -650.0 } );
                        ExecuteHamB(Ham_CS_RoundRespawn, g_iChallenger)
                        set_pev( g_iChallenger , pev_origin , { 50.0 , -150.0 , -650.0 } );
                }
                case 3:
                {
                        ExecuteHamB(Ham_CS_RoundRespawn, g_iChallenged)
                        set_pev( g_iChallenged , pev_origin , { 300.0 , -150.0 , -650.0 } );
                        ExecuteHamB(Ham_CS_RoundRespawn, g_iChallenger)
                        set_pev( g_iChallenger , pev_origin , { 50.0 , -150.0 , -650.0 } );
                }
        }
        challenge[id]++
}



All times are GMT -4. The time now is 18:12.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.