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

[CSGO] Custom Gun Spawn Script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Brrdy
Senior Member
Join Date: Feb 2015
Old 02-27-2015 , 14:29   [CSGO] Custom Gun Spawn Script
Reply With Quote #1

Okay redid this whole thread
I want to use "TeleportEntity" to teleport the entity I have in front of a specified player using the command

My current code currently works to spawn in front of me using eyePos but I want it in front of a specified player

The command I want to use is something like sm_swag <username/idmaybe>

So let's just say this is my code (Its not nor' do I have my code with me.)
So


new weapon = CreateEntityByName("weapon_zeus");
TeleportEntity(WHAT TO PUT HERE TO TP IN FRONT OF A PLAYER/AUTO EQUIP TO PLAYER);
DispatchSpawn(weapon);

Last edited by Brrdy; 02-27-2015 at 14:44. Reason: Fixed so people can actually understand
Brrdy is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 02-27-2015 , 14:48   Re: [CSGO] Custom Gun Spawn Script
Reply With Quote #2

Something like this?
PHP Code:
    decl Float:Origin[3];
    
decl Float:EyeAngles[3];
    
    
GetClientEyeAngles(clientEyeAngles);
    
GetClientAbsOrigin(clientOrigin);
    
    
Origin[0] = (Origin[0] + (15 Cosine(DegToRad(EyeAngles[1]))));
    
Origin[1] = (Origin[1] + (15 Sine(DegToRad(EyeAngles[1]))));
    
    new 
weapon CreateEntityByName("weapon_ak47")
    
SetEntProp(weaponProp_Send"m_iItemDefinitionIndex"7);
    
TeleportEntity(weaponOriginNULL_VECTORNULL_VECTOR); 
This code should spawn weapon in front of client you provide to it...
If spawned weapon is too far or too near then change value that is multiplying cosine and sine (A la 15)
__________________
...

Last edited by Oshizu; 02-27-2015 at 14:50.
Oshizu is offline
Brrdy
Senior Member
Join Date: Feb 2015
Old 02-27-2015 , 14:57   Re: [CSGO] Custom Gun Spawn Script
Reply With Quote #3

Quote:
Originally Posted by Oshizu View Post
Something like this?
PHP Code:
    decl Float:Origin[3];
    
decl Float:EyeAngles[3];
    
    
GetClientEyeAngles(clientEyeAngles);
    
GetClientAbsOrigin(clientOrigin);
    
    
Origin[0] = (Origin[0] + (15 Cosine(DegToRad(EyeAngles[1]))));
    
Origin[1] = (Origin[1] + (15 Sine(DegToRad(EyeAngles[1]))));
    
    new 
weapon CreateEntityByName("weapon_ak47")
    
SetEntProp(weaponProp_Send"m_iItemDefinitionIndex"7);
    
TeleportEntity(weaponOriginNULL_VECTORNULL_VECTOR); 
This code should spawn weapon in front of client you provide to it...
If spawned weapon is too far or too near then change value that is multiplying cosine and sine (A la 15)

Uhm if you don't mind can you do the cvar part to ^_^ I'm a noob for this stuff but I have been working to learn
I see how you did it but yeah idk how to make the CMD itself that does like "sm_sparta <thisuseridhereidkthis>"

I know it's using some thing but I forgot and yeah q.q
Brrdy is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 02-27-2015 , 14:59   Re: [CSGO] Custom Gun Spawn Script
Reply With Quote #4

Why not just do:
Code:
new weapon = CreateEntityByName("weapon_ak47");
SetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex", 7);
EquipPlayerWeapon(client, weapon);
Mitchell is offline
Brrdy
Senior Member
Join Date: Feb 2015
Old 02-27-2015 , 15:01   Re: [CSGO] Custom Gun Spawn Script
Reply With Quote #5

Quote:
Originally Posted by Mitchell View Post
Why not just do:
Code:
new weapon = CreateEntityByName("weapon_ak47");
SetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex", 7);
EquipPlayerWeapon(client, weapon);
I could Sorry I just am new to all cmds didn't even know equip player weapon existed

Any chance you can help with what I posted above like how to specify the client via cmd
Brrdy is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 02-27-2015 , 15:30   Re: [CSGO] Custom Gun Spawn Script
Reply With Quote #6

Done...
Attached Files
File Type: sp Get Plugin or Get Source (swag.sp - 317 views - 1.1 KB)
__________________
...
Oshizu is offline
Brrdy
Senior Member
Join Date: Feb 2015
Old 02-27-2015 , 16:01   Re: [CSGO] Custom Gun Spawn Script
Reply With Quote #7

Quote:
Originally Posted by oshizu View Post
done...
love you <3
Brrdy is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 02-27-2015 , 16:49   Re: [CSGO] Custom Gun Spawn Script
Reply With Quote #8

That'll crash your server and some unexpected things happen like the ak47 gets unlimited ammo for some reason.
You'll also need to DispatchSpawn(weapon) before giving it to them.
Mitchell is offline
Brrdy
Senior Member
Join Date: Feb 2015
Old 02-27-2015 , 17:35   Re: [CSGO] Custom Gun Spawn Script
Reply With Quote #9

Quote:
Originally Posted by Mitchell View Post
That'll crash your server and some unexpected things happen like the ak47 gets unlimited ammo for some reason.
You'll also need to DispatchSpawn(weapon) before giving it to them.
Yeah I ran into even more problems while working on my script q.q
Brrdy is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 02-27-2015 , 20:17   Re: [CSGO] Custom Gun Spawn Script
Reply With Quote #10

why not just use GivePlayerItem?
8guawong 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 05:18.


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