Raised This Month: $ Target: $400
 0% 

[Request] toggle a script by user themself


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
technokickass
Junior Member
Join Date: Feb 2012
Old 03-12-2012 , 16:43   [Request] toggle a script by user themself
Reply With Quote #1

Hi,

In the thread showthread.php?p=1667069 Bacardi sayed that iam here in the right forum.

Can someone edit this code with that what Bacardi sayed please? :

Bacardi:
Quote:
Originally Posted by Bacardi View Post
Welcome to scripting section.
- Make global Float:variable array MAXPLAYERS + 1 size, where you can store each player value by player index.
- Create console command "sm_boost", on that command callback you can set boost value.
- You can use OnClientConnected to set boost value automatically to 0.35

Or request these your features in plugin own thread or SourceMod section Plugin/Gameplay Ideas and Requests.
I realy dont know how i do this please someone do it for me

Code:
Spoiler


THX verry much if someone did it for me
technokickass is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-12-2012 , 18:51   Re: [Request] toggle a script by user themself
Reply With Quote #2

Here...
Code:
new VelocityOffset_0;
new VelocityOffset_1;
new BaseVelocityOffset;

// Declare convar handles

new Handle:hPush;
new Handle:hHeight;

new bool:g_bPush[MAXPLAYERS+1] = { true, ...};

public Plugin:myinfo = 
{
  name = "BunnyHop",
  author = "Soccerdude",
  description = "Boost",
  version = "1.0.1",
  url = "http://sourcemod.net/"
};

public OnPluginStart()
{
	//PrintToServer("----------------|         BunnyHop Loading        |---------------");
	// Hook Events
	HookEvent("player_jump",PlayerJumpEvent);
	// Find offsets
	VelocityOffset_0=FindSendPropOffs("CBasePlayer","m_vecVelocity[0]");
	if(VelocityOffset_0==-1)
	SetFailState("[BunnyHop] Error: Failed to find Velocity[0] offset, aborting");
	VelocityOffset_1=FindSendPropOffs("CBasePlayer","m_vecVelocity[1]");
	if(VelocityOffset_1==-1)
	SetFailState("[BunnyHop] Error: Failed to find Velocity[1] offset, aborting");
	BaseVelocityOffset=FindSendPropOffs("CBasePlayer","m_vecBaseVelocity");
	if(BaseVelocityOffset==-1)
	SetFailState("[BunnyHop] Error: Failed to find the BaseVelocity offset, aborting");
	// Create cvars
	hPush=CreateConVar("bunnyhop_push","0.35","The forward push when you jump");
	hHeight=CreateConVar("bunnyhop_height","1.0","The upward push when you jump");
	// Create config
	AutoExecConfig();
	// Public cvar
	CreateConVar("bunnyhop_version","1.0.1","[BunnyHop] Current version of this plugin",FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
	RegConsoleCmd("sm_boost", cmd_boost);
	//PrintToServer("----------------|         BunnyHop Loaded         |---------------");
}

public OnClientConnected(client)
{
	g_bPush[client] = true;
}

public Action:cmd_boost(client, args)
{
	if(client != 0)
	{
		g_bPush[client] = g_bPush[client] ? false:true;
		ReplyToCommand(client, "Boost %s", g_bPush[client] ? "enabled":"disable");
	}
	return Plugin_Handled;
}

public PlayerJumpEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
	new index=GetClientOfUserId(GetEventInt(event,"userid"));
	new Float:finalvec[3], bool:current = g_bPush[index];
	
	finalvec[0]=GetEntDataFloat(index,VelocityOffset_0)* (current ? (GetConVarFloat(hPush)/2.0):0.0);
	finalvec[1]=GetEntDataFloat(index,VelocityOffset_1)* (current ? (GetConVarFloat(hPush)/2.0):0.0);
	finalvec[2]=GetConVarFloat(hHeight)*50.0;
	SetEntDataVector(index,BaseVelocityOffset,finalvec,true);
}
Bacardi is offline
DarkDragonaite
Junior Member
Join Date: Mar 2012
Old 03-12-2012 , 19:05   Re: [Request] toggle a script by user themself
Reply With Quote #3

Create console command "sm_boost" ?

Who to create a console command ?
DarkDragonaite is offline
technokickass
Junior Member
Join Date: Feb 2012
Old 03-12-2012 , 20:26   Re: [Request] toggle a script by user themself
Reply With Quote #4

THX i try it.
I think it works because ure Veteran Member
technokickass is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-13-2012 , 02:18   Re: [Request] toggle a script by user themself
Reply With Quote #5

Quote:
Originally Posted by technokickass View Post
THX i try it.
I think it works because ure Veteran Member
That title have come from spammin lot of post in here forums.

What I understand your request, player is able to toggle !boost on/off himself. That I did.
Bacardi is offline
technokickass
Junior Member
Join Date: Feb 2012
Old 03-13-2012 , 15:22   Re: [Request] toggle a script by user themself
Reply With Quote #6

Yes ure right, all works +W00T

technokickass 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 04:25.


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