SA-MP Forums Archive
Quick Switch - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Quick Switch (/showthread.php?tid=558690)



Quick Switch - bigboy81 - 18.01.2015

Is there a way to make a system that you can't quickswap your weapon, i mean something that if you shoot with a gun, you cant change the weapon before 3 seconds after you stop shooting?


Re: Quick Switch - ball - 18.01.2015

You can't block weapon changing, but you can use SetPlayerArmedWeapon in timer or OnPlayerUpdate. Save player weapon and time in variables.

Код:
new theWeapon[MAX_PLAYERS], theTime[MAX_PLAYERS];

public OnPlayerWeaponShot(...)
{
	theWeapon[playerid] = weaponid;
	theTime[playerid] = gettime() + 3;
	return 1;
}

public OnPlayerUpdate(playerid)
{
	if(theTime[playerid] >= gettime())
	{
		SetPlayerArmedWeapon(playerid, theWeapon[playerid]);
	}
	return 1;
}
Something like this.


Re: Quick Switch - bigboy81 - 18.01.2015

Not work


Re: Quick Switch - ball - 18.01.2015

Show full code, I gave only example which mustn't work.


Re: Quick Switch - Schneider - 18.01.2015

Tested it and works fine!


Re: Quick Switch - bigboy81 - 18.01.2015

I want make something which will detect is player fast switch weapon,and if is yes server say him you cant this very fast,please wait some second and try again


Re: Quick Switch - Sime30 - 18.01.2015

Quote:
Originally Posted by bigboy81
Посмотреть сообщение
I want make something which will detect is player fast switch weapon,and if is yes server say him you cant this very fast,please wait some second and try again
Freeze him , send him a message, unfreeze him with a timer


Re: Quick Switch - ball - 18.01.2015

I won't give you full working code, sorry - here is help how to start, rest thing you have to do on your own. If you want full code look for scripter for money.


Re: Quick Switch - bigboy81 - 18.01.2015

ball don't help me please, i don't need help from people who don't want show me the full code.
leave out


Re: Quick Switch - Schneider - 18.01.2015

@Bigboy: Ball is right, we are not here to give you full working scripts, if that's what you want, you have to go to the request-topic where you can find people who are willing to script for money.

This forum section is just for help. It's you who needs to learn how to script and you won't learn anything if we hand you complete scripts. You have to do it yourself and if you have any questions or trouble with something, you can ask it here and we are here to help you.

That's how you learn to script.