Any Ideas? - 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: Any Ideas? (
/showthread.php?tid=372763)
Any Ideas? -
Tass007 - 28.08.2012
Hello i have no idea in how to do this but how would i make these weapons have restrictions so that only level 1337
the weapons are (4,9,35-40)
Re: Any Ideas? -
Dan. - 28.08.2012
Just dont give the players these weapons.. or just set a timer ongamemode init, that check all the players after X amount of time and set it as repeating. If the player has the weapon, remove it.
Re: Any Ideas? -
Tass007 - 28.08.2012
Can you please show an example?
Re: Any Ideas? -
Dan. - 28.08.2012
Under OnGameModeInit:
pawn Код:
SetTimer("CheckWeapons", 1000*5, true); // Runs the timer every 5 seconds
The timer:
pawn Код:
forward CheckWeapons();
public CheckWeapons()
{
new weapons[13][2]; // The array where to store the weapon data
for(new p = 0; p < MAX_PLAYERS; p++) // We loop through all the players
{
for (new i = 0; i < 13; i++) // SAMP has 13 weapon slots, so we loop through every one
{
GetPlayerWeaponData(p, i, weapons[i][0], weapons[i][1]); // This gets the weapon data from the weapon slot
if(weapons[i][0] == 4 || weapons[i][0] == 9 || weapons[i][0] == 35 || weapons[i][0] == 36 || weapons[i][0] == 37 || weapons[i][0] == 38 || weapons[i][0] == 39 || weapons[i][0] == 40) // The weaponid will be stored in weapons[i][0], so we check if it matches our weapon ID's
{
GivePlayerWeapon(p, weapons[i][0], 0); // Removes the player's weapon
}
}
}
There may be a more efficient way, because running loops in a timer isn't the best way I think, but it should work!
Re: Any Ideas? -
Tass007 - 28.08.2012
Thank you very much +1 rep.