SA-MP Forums Archive
About weapons :D (I will repp+) - 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: About weapons :D (I will repp+) (/showthread.php?tid=448696)



About weapons :D (I will repp+) - radiobizza - 05.07.2013

Is it possible or is there a weapon that does not reload bullets? If so ... tell me how
I will repp+


Re: About weapons :D (I will repp+) - _Khaled_ - 05.07.2013

I think you should add
pawn Код:
GivePlayerWeapon(playerid, ID, AMMO);
under OnPlayerUpdate, try that, it should work


Re: About weapons :D (I will repp+) - Lordzy - 05.07.2013

Keep on giving ammo to the player on a repeating timer. I'm not sure whether it might create a break while shooting continuously.
pawn Код:
new bool:p_Spawned[MAX_PLAYERS]; //To clarify whether player is spawned or not.
public OnPlayerConnect(playerid)
{
 p_Spawned[playerid] = false;
 return 1;
}

public OnPlayerSpawn(playerid)
{
 p_Spawned[playerid] = true;
 return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
 p_Spawned[playerid] = false;
 return 1;
}

public OnFilterScriptInit()
{
 SetTimer("NoReload_", 350, true); //Depends on the sync or fire rate, not sure if this timer could work perfectly. In some cases, no reload might not work well.
 return 1;
}

forward NoReload_();
public NoReload_()
{
 for(new i; i< GetMaxPlayers(); i++)
 {
  if(!IsPlayerConnected(i)) continue;
  if(p_Spawned[i] != 1) continue;
  GivePlayerWeapon(i, GetPlayerWeapon(i), 1000);
 }
 return 1;
}
Not sure about this as I haven't tested, but something like this is so.


Re: About weapons :D (I will repp+) - Sandiel - 05.07.2013

Create a repeating timer, I recommend using a 300-500 ms interval.
inside the timer, check the player ammo, if it's less than the max ammo, set his ammo to the max one (the long part is creating conditions for each gun, considering that not all guns have the same max ammo value, ex: deagle's is 7, spas is 12 or something, I'm not sure but you get the point)
https://sampwiki.blast.hk/wiki/GetPlayerAmmo
https://sampwiki.blast.hk/wiki/SetPlayerAmmo


Re: About weapons :D (I will repp+) - radiobizza - 06.07.2013

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
Keep on giving ammo to the player on a repeating timer. I'm not sure whether it might create a break while shooting continuously.
pawn Код:
new bool:p_Spawned[MAX_PLAYERS]; //To clarify whether player is spawned or not.
public OnPlayerConnect(playerid)
{
 p_Spawned[playerid] = false;
 return 1;
}

public OnPlayerSpawn(playerid)
{
 p_Spawned[playerid] = true;
 return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
 p_Spawned[playerid] = false;
 return 1;
}

public OnFilterScriptInit()
{
 SetTimer("NoReload_", 350, true); //Depends on the sync or fire rate, not sure if this timer could work perfectly. In some cases, no reload might not work well.
 return 1;
}

forward NoReload_();
public NoReload_()
{
 for(new i; i< GetMaxPlayers(); i++)
 {
  if(!IsPlayerConnected(i)) continue;
  if(p_Spawned[i] != 1) continue;
  GivePlayerWeapon(i, GetPlayerWeapon(i), 1000);
 }
 return 1;
}
Not sure about this as I haven't tested, but something like this is so.
thxx