Reloading - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Reloading (
/showthread.php?tid=176588)
Reloading -
Dime - 13.09.2010
How can i make when player shot and start reloading he get 3dtextlabel "Reloading"..I mean i know make that.But how i get when player reload.
sry bad english
Re: Reloading -
Mauzen - 13.09.2010
You can use GetPlayerWeaponState (
https://sampwiki.blast.hk/wiki/GetPlayerWeaponState) in a timer or OnPlayerUpdate to detect it. Create a variable storing the last state, then add the label when it changes from somethiong to WEAPONSTATE_RELOADING and remove it when it changes back.
Hope i could help you
Re: Reloading -
Dime - 14.09.2010
I dont understand.
Re: Reloading -
Mauzen - 14.09.2010
pawn Код:
new laststate[MAX_PLAYERS];
new Text3D:reloadlabel[MAX_PLAYERS];
public OnPlayerUpdate(playerid) //Add here
if(GetPlayerWeaponState(playerid) == WEAPONSTATE_RELOADING && laststate[playerid] != WEAPONSTATE_RELOADING)
{
//Player starts reloading
//Do your label stuff here, e.g.
reloadlabel[playerid] = Create3DTextLabel("Reloading...", 0xAAAA33FF, 0.0, 0.0, 0.0, 30.0, 0, 1);
Attach3DTextLabelToPlayer(reloadlabel[playerid], playerid, 0.0, 0.0, 1.0);
} else if(GetPlayerWeaponState(playerid) != WEAPONSTATE_RELOADING && laststate[playerid] == WEAPONSTATE_RELOADING)
{
//Player finishes reloading
//Delete the label here
Delete3DTextLabel(reloadlabel[playerid);
}
laststate[playerid] = GetPlayerWeaponState(playerid);
return 1;
}
Untested and without guarantee, but I think it should work.