Raised This Month: $ Target: $400
 0% 

I start scripting!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XIII
Junior Member
Join Date: Jun 2011
Old 06-02-2011 , 15:30   I start scripting!
Reply With Quote #1

Hello all,

Already I've come download many plugin on your site is a very good site!

So as the title says I start the script I already know how to shop basing myself on encian shop.

I have a zombie server and I wanted to create lines without taking on another plugin zp_class

So I come to ask for help here

So I'd like to make a plugin zp_class: Grab zombie.

For example, it can hang on the subject ... Finally I want to give him the grab and want to know what to mark how to put the line if there is a presentation so that the script works ... etc.

Many thank you very good site !!!!!
XIII is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 06-02-2011 , 18:31   Re: I start scripting!
Reply With Quote #2

Quote:
Originally Posted by XIII View Post
Hello all,

Already I've come download many plugin on your site is a very good site!

So as the title says I start the script I already know how to shop basing myself on encian shop.

I have a zombie server and I wanted to create lines without taking on another plugin zp_class

So I come to ask for help here

So I'd like to make a plugin zp_class: Grab zombie.

For example, it can hang on the subject ... Finally I want to give him the grab and want to know what to mark how to put the line if there is a presentation so that the script works ... etc.

Many thank you very good site !!!!!
Bro search and Good Luck
2reason2kill is offline
XIII
Junior Member
Join Date: Jun 2011
Old 06-03-2011 , 05:03   Re: I start scripting!
Reply With Quote #3

Ok but who can help me for start scripting?
XIII is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 06-03-2011 , 05:48   Re: I start scripting!
Reply With Quote #4

Quote:
Originally Posted by XIII View Post
Ok but who can help me for start scripting?
I think u should look here
2reason2kill is offline
XIII
Junior Member
Join Date: Jun 2011
Old 06-03-2011 , 06:03   Re: I start scripting!
Reply With Quote #5

I have scripted and compilated localy my plugin but much error who can correct me plz here ii's my scriptzp_zombie_grab)

Code:
/*================================================================================
    
    --------------------------------------------
    -*- [ZP] Zombie Class: Grab Zombie 1.0 -*-
    --------------------------------------------
    
    ---------------
     Description 
    ---------------
    
    This zombie can grab him..
    
================================================================================*/

#include <amxmodx>
#include <hamsandwich>
#include <hlsdk_const>
#include <zombieplague>
#include <amxmodx>
#include <fun>
#include <engine>

/*================================================================================
 [Plugin Customization]
=================================================================================*/

// Grab Zombie Attributes
new const zclass_name[] = { "Grab Zombie" }
new const zclass_info[] = { "HP- can grab" }
new const zclass_model[] = { "zombie_source" }
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" }
const zclass_health = 1400
const zclass_speed = 180
const Float:zclass_gravity = 1.0
const Float:zclass_knockback = 1.0

/*============================================================================*/

// Class ID
new g_zclass_Grab

// Zombie Classes MUST be registered on plugin_precache
public plugin_precache()
{
    register_plugin("[ZP] Class: Grab Zombie", "1.0", "XIII")
    
    // Register the new class and store ID for reference
    g_zclass_grab = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)    
    
}

{
    register_cvar("sv_grabforce","8")
    register_clcmd("grab_toggle","grab_toggle",ADMIN_SLAY,"press once to grab and again to release")
    register_clcmd("+grab","grab",ADMIN_SLAY,"bind a key to +grab")
    register_clcmd("-grab","release",ADMIN_SLAY)
    register_event("StatusValue","spec_event","be","1=2")
}



new grabbed[33]
new grablength[33]
new bool:grabmodeon[33]
new velocity_multiplier

public grabtask(parm[])
{
    new id = parm[0]
    new targetid, body
    if (!grabbed[id])
    {
        get_g_zclass_grab_aiming(id, targetid, body)
        if (targetid)
        {
            set_grabbed(id, targetid)
        }
    }
    if (grabbed[id])
    {
        new origin[3], look[3], direction[3], moveto[3], grabbedorigin[3], velocity[3], length

        if (!is_user_alive(grabbed[id]))
        {
            release(id)
            return
        }

        get_g_zclass_grab_origin(id, origin, 1)
        get_g_zclass_grab_origin(id, look, 3)
        get_g_zclass_grab_origin(grabbed[id], grabbedorigin)

        direction[0]=look[0]-origin[0]
        direction[1]=look[1]-origin[1]
        direction[2]=look[2]-origin[2]
        length = get_distance(look,origin)
        if (!length) length=1                // avoid division by 0

        moveto[0]=origin[0]+direction[0]*grablength[id]/length
        moveto[1]=origin[1]+direction[1]*grablength[id]/length
        moveto[2]=origin[2]+direction[2]*grablength[id]/length

        velocity[0]=(moveto[0]-grabbedorigin[0])*velocity_multiplier
        velocity[1]=(moveto[1]-grabbedorigin[1])*velocity_multiplier
        velocity[2]=(moveto[2]-grabbedorigin[2])*velocity_multiplier

        new Float:vector[3]
        IVecFVec(velocity, vector)
        entity_set_vector(grabbed[id], EV_VEC_velocity, vector)
    }
}

zombie_grab grab_toggle(id)
{
    if (grabmodeon[id])
        release(id)
    else
        grab(id)
    return PLUGIN_HANDLED
}

zombie_grab grab(id)
{
    if (!(get_user_flags(id)&ADMIN_SLAY))
    {
        client_print(id,print_notify,"[AMXX] You have no access to that command")
        return PLUGIN_HANDLED
    }
    if (!grabmodeon[id])
    {
        new targetid, body
        new parm[1]
        parm[0] = id
        velocity_multiplier = get_cvar_num("sv_grabforce")
        grabmodeon[id]=true
        set_task(0.1, "grabtask", 100+id, parm, 1, "b")
        get_zombie_grab_aiming(id, targetid, body)
        if (targetid)
        {
            set_grabbed(id, targetid)
        }
        else
        {
            client_print(id,print_notify,"[AMXX] Searching for a target")
        }
    }
    return PLUGIN_HANDLED
}

zombie_grab release(id)
{
    if (!(get_user_flags(id)&ADMIN_SLAY))
    {
        client_print(id,print_notify,"[AMXX] You have no access to that command")
        return PLUGIN_HANDLED
    }
    if (grabmodeon[id])
    {
        grabmodeon[id]=false
        if (grabbed[id])
        {
            new targname[32]
            set_zombie_grab_gravity(grabbed[id])
            set_zombie_grab_rendering(grabbed[id])
            get_zombie_grab(grabbed[id],targname,31)
            client_print(id,print_notify,"[AMXX] You have released %s", targname)
        }
        else
        {
            client_print(id,print_notify,"[AMXX] No target found")
        }
        grabbed[id]=0
        remove_task(100+id)
    }
    return PLUGIN_HANDLED
}

public spec_event(id)
{
    new targetid = read_data(2)

    if (targetid < 1 || targetid > 32)
        return PLUGIN_CONTINUE

    if (grabmodeon[id] && !grabbed[id])
    {
        set_grabbed(id, targetid)
    }
    return PLUGIN_CONTINUE
}

public set_grabbed(id, targetid)
{
    new origin1[3], origin2[3], targname[32]
    get_user_zombie_grab(id, zombie_grab1)
    get_user_zombie_grab(targetid, zombie_grab2)
    grabbed[id]=targetid
    grablength[id]=get_distance(zombie_grab1,zombie_grab2)
    set_zombie_grab_gravity(targetid,0.001)
    set_zombie_grab_rendering(targetid,kRenderFxGlowShell,50,0,0, kRenderNormal, 16)
    get_zombie_grab_name(targetid,targname,31)
    client_print(id,print_notify,"[AMXX] You have grabbed onto %s", targname)
}

Last edited by XIII; 06-03-2011 at 06:15.
XIII is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-03-2011 , 06:06   Re: I start scripting!
Reply With Quote #6

Use [php] or [code] tags in the forum to post codes !
__________________
Hunter-Digital is offline
XIII
Junior Member
Join Date: Jun 2011
Old 06-03-2011 , 06:15   Re: I start scripting!
Reply With Quote #7

sorry man who can help me???
XIII is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-03-2011 , 06:17   Re: I start scripting!
Reply With Quote #8

You should first learn to make a verry simple plugin to understand compile errors and such... and that is not a verry simple plugin.
__________________
Hunter-Digital is offline
XIII
Junior Member
Join Date: Jun 2011
Old 06-03-2011 , 06:19   Re: I start scripting!
Reply With Quote #9

I know xD i know how to creat a simple zombie classe it's very simpl but i want to know more in scripting
XIII is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-03-2011 , 06:21   Re: I start scripting!
Reply With Quote #10

You can start by trying to understand your compile errors.
Post them and we'll try to explain them to you.
__________________
Hunter-Digital is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:49.


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