[Pregunta] Como hago esto...
#12

Aca te dejo un mini-script para hacer lo que tu quieres:
pawn Код:
#include <a_samp>

#define INTERVAL    (500)

enum PD
{
    Weapon[13],
    Ammo[13],
    Timer
};
new Info[MAX_PLAYERS][PD];

public OnPlayerConnect(playerid)
{
    Info[playerid][Timer] = SetTimerEx("PlayerStatusChecker", INTERVAL, 1, "i", playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(Info[playerid][Timer]);
    return 1;
}

forward PlayerStatusChecker(playerid);
public PlayerStatusChecker(playerid)
{
    new weapon, ammo;
    for(new i;  i<13; i++){
        GetPlayerWeaponData(playerid, i, weapon, ammo);
        if(Info[playerid][Weapon][i] == weapon){
            if(Info[playerid][Ammo][i] > ammo){
                CallLocalFunction("OnPlayerShot", "iii", playerid, weapon, (Info[playerid][Ammo][i] - ammo));
                Info[playerid][Ammo][i] = ammo;
            }
            else if(Info[playerid][Ammo][i] < ammo)
                Info[playerid][Ammo][i] = ammo;
        }
        else
        {
            Info[playerid][Weapon][i] = weapon;
            Info[playerid][Ammo][i] = ammo;
        }
    }
}

forward OnPlayerShot(playerid, weapon, bullets);

public OnPlayerShot(playerid, weapon, bullets)
{
    //Aqui pones las acciones a realizar cuando el jugador dispara 1 o mas balas
    return 1;
}
Reply


Messages In This Thread
[Pregunta] Como hago esto... - by JuliPera - 13.04.2012, 14:55
Respuesta: [Pregunta] Como hago esto... - by TiNcH010 - 13.04.2012, 17:00
Re: Respuesta: [Pregunta] Como hago esto... - by JuliPera - 13.04.2012, 17:43
Respuesta: [Pregunta] Como hago esto... - by TiNcH010 - 13.04.2012, 17:53
Re: [Pregunta] Como hago esto... - by JuliPera - 13.04.2012, 18:18
Respuesta: [Pregunta] Como hago esto... - by nagato.samp - 13.04.2012, 18:29
Re: Respuesta: [Pregunta] Como hago esto... - by JuliPera - 13.04.2012, 19:33
Re: [Pregunta] Como hago esto... - by JuliPera - 13.04.2012, 19:51
Respuesta: Re: [Pregunta] Como hago esto... - by nagato.samp - 13.04.2012, 20:50
Re: Respuesta: Re: [Pregunta] Como hago esto... - by JuliPera - 14.04.2012, 20:32
Re: [Pregunta] Como hago esto... - by Glimma - 05.11.2012, 01:18
Respuesta: [Pregunta] Como hago esto... - by TheChaoz - 05.11.2012, 18:36

Forum Jump:


Users browsing this thread: 3 Guest(s)