AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Question about Speed (https://forums.alliedmods.net/showthread.php?t=92915)

hleV 05-22-2009 06:32

Re: Question about Speed
 
WTF?

EDIT: It's not my thread, I just replied to it. o_O

Arkshine 05-22-2009 06:33

Re: Question about Speed
 
The thread was buggy for me, too. I was seeing nothing.

Mr.Noobie 05-27-2009 02:35

Re: Question about Speed
 
o.O

So back to the topic,

I use this:

set_pev(id, pev_maxspeed, 370.0)

why it didn't work on the game?

Arkshine 05-27-2009 03:17

Re: Question about Speed
 
The syntax is right, now is depending where you have putted this code.

Mr.Noobie 05-27-2009 03:28

Re: Question about Speed
 
Codes:

Code:

#include <amxmodx>
#include <zombieplague>
#include <fakemeta>
new g_itemhp, Armor, Health, Gravity
public plugin_init()
{
 register_plugin("[ZP] Human Pack", "1.3", "zombieplague")
 g_itemhp = zp_register_extra_item("Human Pack", 35, ZP_TEAM_HUMAN)
 Health = register_cvar("zp_hp_health", "500");    // Amount of HP
 Armor = register_cvar("zp_hp_armor", "500");    // Amount of Armor
 Gravity = register_cvar("zp_hp_gravity", "0.7");    // Amount of Gravity 
}
public zp_extra_item_selected(id, itemid)
{
 if (itemid == g_itemhp)
 {
  // Speed
  set_pev(id, pev_maxspeed, 370.0)
  // Health
  set_pev(id, pev_health, (pev(id, pev_health) + get_pcvar_float(Health)))
  // Armor
  set_pev(id, pev_armorvalue, (pev(id, pev_armorvalue) + get_pcvar_float(Armor)))
        // Gravity
  fm_set_user_gravity(id, get_pcvar_float(Gravity))
        // Weapon
        fm_give_item(id, "weapon_mp5navy")
        fm_give_item(id, "weapon_ak47")
        fm_give_item(id, "weapon_m4a1")
  fm_give_item(id, "weapon_awp")
  fm_give_item(id, "weapon_deagle")
        // Item
        fm_give_item(id, "weapon_hegrenade")
  fm_give_item(id, "weapon_flashbang")
        fm_give_item(id, "weapon_smokegrenade")
        // BP ammo
        fm_set_user_bpammo(id, CSW_DEAGLE, 150)
        fm_set_user_bpammo(id, CSW_AK47, 250)
        fm_set_user_bpammo(id, CSW_M4A1, 250)
        fm_set_user_bpammo(id, CSW_AWP, 200)
        fm_set_user_bpammo(id, CSW_MP5NAVY, 250)
        client_print(id, print_chat, "[ZP] You have bought a Human Pack")
 }
}
stock fm_set_user_bpammo(id, weaponid, amnt)
{
    static offset;
    switch(weaponid)
    {
        case CSW_AWP: offset = 377;
        case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = 378;
        case CSW_M249: offset = 379;       
        case CSW_FAMAS,CSW_M4A1,CSW_AUG,CSW_SG550,CSW_GALI,CSW_SG552: offset = 380;
        case CSW_M3,CSW_XM1014: offset = 381;
        case CSW_USP,CSW_UMP45,CSW_MAC10: offset = 382;
        case CSW_FIVESEVEN,CSW_P90: offset = 383;
        case CSW_DEAGLE: offset = 384;
        case CSW_P228: offset = 385;
        case CSW_GLOCK18,CSW_MP5NAVY,CSW_TMP,CSW_ELITE: offset = 386;
        case CSW_FLASHBANG: offset = 387;
        case CSW_HEGRENADE: offset = 388;
        case CSW_SMOKEGRENADE: offset = 389;
        default: return 0;
    }
    set_pdata_int(id,offset,amnt,5);
   
    return 1;
}
stock fm_set_user_gravity(index, Float:gravity = 1.0) {
    set_pev(index, pev_gravity, gravity);
    return 1;
}
stock fm_give_item(id, const item[])
{
    static ent
    ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
    if (!pev_valid(ent)) return;
   
    static Float:originF[3]
    pev(id, pev_origin, originF)
    set_pev(ent, pev_origin, originF)
    set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
    dllfunc(DLLFunc_Spawn, ent)
   
    static save
    save = pev(ent, pev_solid)
    dllfunc(DLLFunc_Touch, ent, id)
    if (pev(ent, pev_solid) != save)
        return;
   
    engfunc(EngFunc_RemoveEntity, ent)
}

I put at here:

PHP Code:

 if (itemid == g_itemhp)
 {
   
// Speed
   
set_pev(idpev_maxspeed370.0


Arkshine 05-27-2009 03:47

Re: Question about Speed
 
Give the speed after giving weapon, because speed is initialized when you get a weapon.

Mr.Noobie 05-27-2009 06:13

Re: Question about Speed
 
Quote:

Originally Posted by arkshine (Post 835557)
Give the speed after giving weapon, because speed is initialized when you get a weapon.

which mean:

PHP Code:

set_pev(idpev_maxspeed370.0)
public 
zp_extra_item_selected(iditemid)
{
 if (
itemid == g_itemhp)
 { 

??

Arkshine 05-27-2009 06:32

Re: Question about Speed
 
I say after not before -_-.

In zp_extra_item_selected, after the last fm_give_item() for example.

zwfgdlc 05-27-2009 06:47

Re: Question about Speed
 
try this.
PHP Code:

set_pev(idpev_maxspeed370.0);
client_cmd(id,"lastinv;lastinv"); 


Mr.Noobie 05-27-2009 09:49

Re: Question about Speed
 
Quote:

Originally Posted by zwfgdlc (Post 835660)
try this.
PHP Code:

set_pev(idpev_maxspeed370.0);
client_cmd(id,"lastinv;lastinv"); 


Quote:

Originally Posted by arkshine (Post 835653)
I say after not before -_-.

In zp_extra_item_selected, after the last fm_give_item() for example.

It didn't work


All times are GMT -4. The time now is 01:30.

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