Sign in to follow this  
ultranewbie

SetSpawnWeapon( <weapon name>)

Recommended Posts

is not working 

SetSpawnWeapon( <weapon name>)

call this function from cmd like this

test(){

	self SetSpawnWeapon("ak47");

}

how can i set weapons to player before spawn  

Share this post


Link to post
Share on other sites

tried not working,,, and  

scenario - >

joined server -> called function -> killed my self -> weapon not set 

Share this post


Link to post
Share on other sites

I assume you actually gave the player the weapon first before setting it as the spawn weapon.

Share this post


Link to post
Share on other sites
3 minutes ago, Sheryl said:

I assume you actually gave the player the weapon first before setting it as the spawn weapon.

This is what I do for my sniper server 

self GiveWeapon( "remington700_mp" );

 self SetSpawnWeapon( "remington700_mp");
 self SwitchToWeapon("remington700_mp");

  • Thanks 1

Share this post


Link to post
Share on other sites

thanks @Sheryl @wkuzma 
i didnt gave weapon before 

here

is what i tried
pri(){
	self takeallweapons();
	self giveWeapon ("ak74u_mp");
	self givemaxammo ("ak74u_mp");
	self giveWeapon("deserteaglegold_mp");
	self givemaxammo("deserteaglegold_mp");
	self iPrintln("^1Weapon Ak74u Given");
 	self SetSpawnWeapon("ak74u_mp");
	self switchtoweapon( "ak74u_mp" );
}
/* above function called from the test cmd like in video*/

 

Share this post


Link to post
Share on other sites

Typically this is done in the giveloadout function either in class or class unranked. Depending on your mod. No file is needed and the above is all you should need to do. giveweapon, the ammo, setspawnweapon and then spawn normally. Switching to the weapon shouldnt be needed. Unless I suppose the idea is to start with something other than the primary.

However if you have a custom gametype, such as gungame, that overrides the standard giveloadout then you also need to check that gametype gsc giveloadout (orwhatever the file called it) to see what is done there.

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this