Raised This Month: $51 Target: $400
 12% 

knife model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wantedCSGO
Junior Member
Join Date: Mar 2020
Old 04-08-2020 , 06:14   knife model
Reply With Quote #1

Haw to add model for knife?

PHP Code:
#include <sdktools>
#include <sdkhooks>
#include <clientprefs>

#define MOD_TAG "\x01\x0B★ \x07[Knife Mod]\x04 "
public Plugin myinfo 
{
    
name "[DR] Knife Mod"
    
description "Knife Mod import from cs1.6"
    
author "spunko && Brum Brum"
    
version "1.0"
    
url "https://forums.alliedmods.net/showthread.php?p=378952"
};

ConVar CVAR_HIGHSPEEDCVAR_LOWSPEEDCVAR_LOWGRAVCVAR_HEALTH_ADDCVAR_HEALTH_MAXCVAR_DAMAGE;

Handle g_selectedknife;

int Knife[MAXPLAYERS 1];

bool MoreDamageLowSpeed[MAXPLAYERS 1], NoFootSteps[MAXPLAYERS 1], HighSpeed[MAXPLAYERS 1], MoreLowGravity[MAXPLAYERS 1], HealthRegeneration[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
    
    
g_selectedknife RegClientCookie("sm_knifeselected""Selected knife skills"CookieAccess_Protected);
    
RegConsoleCmd("sm_knife"Display_Knife);
    
    
CVAR_HIGHSPEED CreateConVar("km_highspeed""1.3")
    
CVAR_LOWSPEED CreateConVar("km_lowspeed""0.7")
    
CVAR_HEALTH_ADD CreateConVar("km_addhealth""3")
    
CVAR_HEALTH_MAX CreateConVar("km_maxhealth""75")
    
CVAR_DAMAGE CreateConVar("km_damage""2.0")
    
CVAR_LOWGRAV CreateConVar("km_lowgravity""0.6")
    
AutoExecConfig(true"Knife_Mod");
    
AddNormalSoundHook(Sound);
    
CreateTimer(480.0kmodmsg_TIMER_REPEAT);
    
CreateTimer(4.0Healing_TIMER_REPEAT);
}

public 
void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
    if (!
IsFakeClient(client)) {
        
SendConVarValue(clientFindConVar("sv_footsteps"), "0");
    }
}

public 
void OnClientDisconnect(int client)
{
    if (
AreClientCookiesCached(client))
    {
        
char value[11];
        
Format(valuesizeof(value), "%d"Knife[client]);
        
SetClientCookie(clientg_selectedknifevalue);
    }
    
Knife[client] = 0;
    
SDKUnhook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
void OnClientCookiesCached(int client)
{
    
char value[11];
    
GetClientCookie(clientg_selectedknifevaluesizeof(value));
    
Knife[client] = StringToInt(value);
}

public 
Action Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
float lowspeed CVAR_LOWSPEED.FloatValue;
    
float highspeed CVAR_HIGHSPEED.FloatValue;
    
float gravity CVAR_LOWGRAV.FloatValue;
    if (
MoreDamageLowSpeed[client]) {
        
SetEntPropFloat(clientProp_Data"m_flLaggedMovementValue"lowspeed);
    }
    else if (
HighSpeed[client]) {
        
SetEntPropFloat(clientProp_Data"m_flLaggedMovementValue"highspeed);
    }
    else if (
MoreLowGravity[client]) {
        
SetEntityGravity(clientgravity);
    }
}

public 
Action OnPlayerRunCmd(int clientint &buttonsint &impulsefloat vel[3], float angles[3], int &weapon)
{
    
float lowspeed CVAR_LOWSPEED.FloatValue;
    
float highspeed CVAR_HIGHSPEED.FloatValue;
    
float gravity CVAR_LOWGRAV.FloatValue;
    if (
MoreDamageLowSpeed[client]) {
        if (
GetClientSpeed(client) != lowspeed) {
            
SetClientSpeed(clientlowspeed);
        }
    }
    else if (
HighSpeed[client]) {
        if (
GetClientSpeed(client) != highspeed) {
            
SetClientSpeed(clienthighspeed);
        }
    }
    else if (
MoreLowGravity[client]) {
        if (
GetEntityGravity(client) != gravity) {
            
SetEntityGravity(clientgravity);
        }
    }
}

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    if (
MoreDamageLowSpeed[attacker])
    {
        
char weapons[64];
        
float dmg CVAR_DAMAGE.FloatValue;
        
GetClientWeapon(attackerweaponssizeof(weapons));
        if ((
StrContains(weapons"knife"false) != -1) || (StrContains(weapons"bayonet"false) != -1))
        {
            
damage *= dmg;
            return 
Plugin_Changed;
        }
    }
    return 
Plugin_Continue;
}

public 
Action Display_Knife(int clientint args)
{
    
Menu menu = new Menu(Menu_Handler);
    
menu.SetTitle("Knife Mod");
    
menu.AddItem("""Machete (More Damage/Low Speed)");
    
menu.AddItem("""Bak Knife (No Footsteps)");
    
menu.AddItem("""Pocket Knife (High Speed)");
    
menu.AddItem("""Butcher Knife (More Low Gravity)");
    
menu.AddItem("""Default Knife (Health Regeneration)");
    
menu.ExitButton false;
    
menu.Display(client60);
}

public 
int Menu_Handler(Menu menuMenuAction actionint clientint item)
{
    if (
action == MenuAction_Select)
    {
        switch (
item)
        {
            case 
0:SetKnife(client0)
            case 
1:SetKnife(client1)
            case 
2:SetKnife(client2)
            case 
3:SetKnife(client3)
            case 
4:SetKnife(client4)
        }
    }
    if (
action == MenuAction_End)delete menu;
}

public 
SetKnife(int clientint knife) {
    switch (
knife)
    {
        case 
0:
        {
            
RestartStats(client);
            
MoreDamageLowSpeed[client] = true;
            
NoFootSteps[client] = false;
            
HighSpeed[client] = false;
            
MoreLowGravity[client] = false;
            
HealthRegeneration[client] = false;
            
RestartStats(client);
            
Knife[client] = 1;
        }
        case 
1:
        {
            
RestartStats(client);
            
MoreDamageLowSpeed[client] = false;
            
NoFootSteps[client] = true;
            
HighSpeed[client] = false;
            
MoreLowGravity[client] = false;
            
HealthRegeneration[client] = false;
            
Knife[client] = 2;
        }
        case 
2:
        {
            
RestartStats(client);
            
MoreDamageLowSpeed[client] = false;
            
NoFootSteps[client] = false;
            
HighSpeed[client] = true;
            
MoreLowGravity[client] = false;
            
HealthRegeneration[client] = false;
            
Knife[client] = 3;
        }
        case 
3:
        {
            
RestartStats(client);
            
MoreDamageLowSpeed[client] = false;
            
NoFootSteps[client] = false;
            
HighSpeed[client] = false;
            
MoreLowGravity[client] = true;
            
Knife[client] = 4;
        }
        case 
4:
        {
            
RestartStats(client);
            
MoreDamageLowSpeed[client] = false;
            
NoFootSteps[client] = false;
            
HighSpeed[client] = false;
            
MoreLowGravity[client] = false;
            
HealthRegeneration[client] = true;
            
Knife[client] = 5;
        }
    }
}

public 
Action Healing(Handle timer)
{
    
int maxhp CVAR_HEALTH_MAX.IntValue;
    
int addhp CVAR_HEALTH_ADD.IntValue;
    for (
int i 1MaxClientsi++)
    {
        if (
IsValidClient(i))
        {
            if (
HealthRegeneration[i] && IsPlayerAlive(i))
            {
                if (
GetClientHealth(i) < maxhp)
                {
                    
SetEntityHealth(iGetClientHealth(i) + addhp);
                }
            }
        }
    }
}

public 
Action Sound(int clients[MAXPLAYERS], int &numClientschar sample[PLATFORM_MAX_PATH], int &entityint &channelfloat &volumeint &levelint &pitchint &flagschar soundEntry[PLATFORM_MAX_PATH], int &seed)
{
    if (!
IsValidClient(entity) || IsFakeClient(entity))
        return 
Plugin_Continue;
    
    if ((
StrContains(sample"physics") != -|| StrContains(sample"footsteps") != -1) && StrContains(sample"suit") == -1)
    {
        if (!
NoFootSteps[entity])
            
EmitSoundToAll(sampleentity);
        
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;
}

public 
Action kmodmsg(Handle timer) {
    
PrintToChatAll("%s Type /knife to change your knife skills"MOD_TAG);
}

void RestartStats(int client)
{
    
SetClientSpeed(client1.0);
    
SetEntityGravity(client1.0);
}

void SetClientSpeed(int clientfloat speed)
{
    
SetEntPropFloat(clientProp_Data"m_flLaggedMovementValue"speed);
}
float GetClientSpeed(int client)
{
    return 
GetEntPropFloat(clientProp_Data"m_flLaggedMovementValue");
}

public 
bool IsValidClient(int client)
{
    if (!(
<= client <= MaxClients) || !IsClientInGame(client) || !IsClientConnected(client) || IsFakeClient(client) || IsClientSourceTV(client))
        return 
false;
    
    return 
true;


please 1 exemple

Last edited by wantedCSGO; 04-11-2020 at 12:55.
wantedCSGO is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-08-2020 , 17:22   Re: knife model
Reply With Quote #2

Do you want learn scripting ?
Bacardi is offline
wantedCSGO
Junior Member
Join Date: Mar 2020
Old 04-11-2020 , 09:59   Re: knife model
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
Do you want learn scripting ?
you help me?
wantedCSGO is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-11-2020 , 10:16   Re: knife model
Reply With Quote #4

Well, because we are in Sourcemod Scripting section, I teach you your first code.

Go Advanced

Add code or PHP tags.
Put code between tags:

Code:
My code
PHP Code:
// My code
int awesome 1
Preview Post
Attached Thumbnails
Click image for larger version

Name:	first code 1.png
Views:	52
Size:	63.3 KB
ID:	180722   Click image for larger version

Name:	first code 2.png
Views:	55
Size:	77.6 KB
ID:	180723  
__________________
Do not Private Message @me

Last edited by Bacardi; 04-11-2020 at 10:17.
Bacardi is offline
wantedCSGO
Junior Member
Join Date: Mar 2020
Old 04-11-2020 , 12:56   Re: knife model
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
Well, because we are in Sourcemod Scripting section, I teach you your first code.

Go Advanced

Add code or PHP tags.
Put code between tags:

Code:
My code
PHP Code:
// My code
int awesome 1
Preview Post

done ,edit

plese make 1 exemple haw to add skin knife
wantedCSGO is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-11-2020 , 13:09   Re: knife model
Reply With Quote #6

Then... I have read this
https://blog.counter-strike.net/inde...er_guidelines/


but
https://forums.alliedmods.net/showpo...44&postcount=8
__________________
Do not Private Message @me

Last edited by Bacardi; 04-11-2020 at 13:11.
Bacardi is offline
wantedCSGO
Junior Member
Join Date: Mar 2020
Old 04-11-2020 , 15:10   Re: knife model
Reply With Quote #7

https://forums.alliedmods.net/showthread.php?p=378952
like this..
wantedCSGO 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 13:39.


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