SA-MP Forums Archive
not effect in my server - 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: not effect in my server (/showthread.php?tid=483349)



not effect in my server - vn007322815 - 25.12.2013

I tried to make a script dedicated to police. but when I'm on the server and type the command, nothing happens.

Код:
#include <a_samp>

// Filterscript Settings

#define TAZE_WEAPON 23 // The weapon the tazer needs to be attached to.
#define TAZE_TIMER 8000 // The time needed to be spent until the criminal automatically gets up.
#define TAZE_SPARK 18717 // The objectid of the spark (It's recommended you don't change this...)
#define TAZE_DESTROY 1050 // The time needed to be spent until the spark dissappears.
#define TAZE_LOSEHP 0 // Set to 1 if you want the victim to lose health when shot. Set 0 or any
                                          // other value if you want the victim not to lose health.

//

new Tazer[MAX_PLAYERS];
new Spark[MAX_PLAYERS];
new Tazed[MAX_PLAYERS];

forward DestroySpark(playerid);
forward TazedRemove(playerid);

public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" Reachless' Tazer System v0.3");
        print("--------------------------------------\n");
        return 1;
}
stock IsPlayerCop(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        GetPlayerSkin(playerid);
        new copskin = GetPlayerSkin(playerid);
        if( (copskin == 280) ||  (copskin == 71) || (copskin == 281) || (copskin == 284) || (copskin == 283) || (copskin == 265) || (copskin == 266) || (copskin == 267) || (copskin == 282) || (copskin == 190) || (copskin == 165) ||  (copskin == 285)||(copskin ==166))
        {
        return 1;
        }
    }
    return 0;
}
public OnPlayerConnect(playerid)
{
        Tazed[playerid] = 0;
        Tazer[playerid] = 0;
        return 1;
}

public DestroySpark(playerid)
{
        DestroyObject(Spark[playerid]);
        return 1;
}

public TazedRemove(playerid)
{
        TogglePlayerControllable(playerid, 1);
        ClearAnimations(playerid);
        Tazed[playerid] = 0;
        return 1;
}

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
        if(Tazer[playerid] == 1 && GetPlayerWeapon(playerid) == TAZE_WEAPON)
        {
            new Float:health,losehp;
            GetPlayerHealth(damagedid,health);
            losehp = TAZE_LOSEHP;
            if(Tazed[damagedid] == 1) return 1;
            new Float:x, Float:y, Float:z;
            GetPlayerPos(damagedid, x, y, z);
            ClearAnimations(damagedid);
            ApplyAnimation(damagedid,"PED","KO_skid_front",4.1,0,1,1,1,0);
            Spark[damagedid] = CreateObject(TAZE_SPARK, x, y, z-3, 0, 0, 0);
            SetTimerEx("DestroySpark", TAZE_DESTROY, 0, "i", damagedid);
            SetTimerEx("TazedRemove", TAZE_TIMER, 0, "i", damagedid);
            //TogglePlayerControllable(damagedid, 0);
            Tazed[damagedid] = 1;
            if(losehp) {} else SetPlayerHealth(damagedid, health+amount);
        }
        return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
       if (strcmp("/on", cmdtext, true, 6 && !IsPlayerCop(playerid)) == 0)
       {
	GivePlayerWeapon(playerid, TAZE_WEAPON, 100);
       return 1;
        }
        if (strcmp("/off", cmdtext, true, 6 && !IsPlayerCop(playerid)) == 0)
        {
                new string[256];
                new sendername[MAX_PLAYER_NAME];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(Tazer[playerid] == 0)
                {
                        if(GetPlayerWeapon(playerid) == TAZE_WEAPON) {} else return SendClientMessage(playerid, 0xFFFFFFFF, "{DC0C0C}Tazer: {FFFFFF}You need to attach the tazer to a Silenced Pistol.");
                        Tazer[playerid] = 1;
                        format(string, sizeof(string), "{DC0C0C}Tazer: {FFFFFF}Da Bat Chuc Nang Phong Dien, %s.", sendername);
                        SendClientMessage(playerid, 0xFFFFFFFF, string);
                        return 1;
                }
                else if(Tazer[playerid] == 1)
                {
                    Tazer[playerid] = 0;
                    format(string, sizeof(string), "{DC0C0C}Tazer: {FFFFFF}Da Tat Chuc Nang Phong Dien, %s.", sendername);
                    SendClientMessage(playerid, 0xFFFFFFFF, string);
                    return 1;
                }
                else Tazer[playerid] = 0;
                return 1;
        }
        return 0;
}
pls help me