Reloading
#1

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
Reply
#2

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
Reply
#3

I dont understand.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)