Tazer при выстреле с 9mm

Description: Уроки по скриптингу
Moderator: SJplayer

Miranda F
Topic author, Старшина
Старшина
Avatar
Miranda F
Topic author, Старшина
Старшина
Posts: 143
Joined: 5 Jul 2013
With us: 7 years 4 months

#1by Miranda » 30 Oct 2013, 11:24

Tazer при выстреле с 9mm
Автор : [SKRIPTER]

Ко всем define:

Code: Select all

#define TAZE_WEAPON 23 
#define TAZE_TIMER 8000 
#define TAZE_SPARK 18717 
#define TAZE_DESTROY 1250 
#define TAZE_LOSEHP 1 
#define COLOR_PURPLE 0xC2A2DAAA // цвет тайзера  


Ко всем new:

Code: Select all

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


Ко всем forward:

Code: Select all

forward DestroySpark(playerid);
forward Gamburger(playerid);//Таймер бургера
forward TazedRemove(playerid);  


В паблик onplayerconnect:

Code: Select all

Tazed[playerid] = 0;
Tazer[playerid] = 0;  


Создаем паблики:

Code: Select all

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

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


В паблик OnPlayerGiveDamage:

Code: Select all

 if(Tazer[playerid] == && GetPlayerWeapon(playerid) == TAZE_WEAPON)
        {
            new 
Float:health,losehp;
        
GetPlayerHealth(damagedid,health);
        
losehp TAZE_LOSEHP;
            if(
Tazed[damagedid] == 1) return 1;
            new 
Float:xFloat:yFloat:z;
            
GetPlayerPos(damagedidxyz);
            
ClearAnimations(damagedid);
            
ApplyAnimation(damagedid,"PED","KO_skid_front",4.1,0,1,1,1,0);
            
Spark[damagedid] = CreateObject(TAZE_SPARKxyz-3000);
            
SetTimerEx("DestroySpark"TAZE_DESTROY0"i"damagedid);
            
SetTimerEx("TazedRemove"TAZE_TIMER0"i"damagedid);
            
//TogglePlayerControllable(damagedid, 0);
            
Tazed[damagedid] = 1;
            if(
losehp) {} else SetPlayerHealth(damagedidhealth+amount);
        }  


Ко всем коммандам:

Code: Select all

if (strcmp("/tazer"cmdtexttrue6) == 0)
        {
                new 
string[256];
            new 
sendername[MAX_PLAYER_NAME];
        
GetPlayerName(playeridsendernamesizeof(sendername));
            if(
Tazer[playerid] == 0)
            {
                        if(
GetPlayerWeapon(playerid) == TAZE_WEAPON) {} else return SendClientMessage(playerid0xFFFFFFFF"{d4d4d4}У вас нету шокера");
                        
Tazer[playerid] = 1;
                         
format(stringsizeof(string), "%s активировал шокер"sendername);
                        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        
ApplyAnimation(playerid,"COLT45","colt45_reload",4.1,0,11,1,1);
                          return 
1;
                }
                else if(
Tazer[playerid] == 1)
                {
                    
Tazer[playerid] = 0;
                                             
format(stringsizeof(string), "%s деактивировал шокер"sendername);
                     
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                             
SetTimerEx("Gamburger"5000false"i"playerid);
                  
ApplyAnimation(playerid,"COLT45","colt45_reload",4.1,1,1,1,1,1,1);
                        return 
1;
                }
                else 
Tazer[playerid] = 0;
                return 
1;
        }  


Если нет Proxdetector , тогда создаем:

Code: Select all

stock ProxDetector(Float:radiplayeridstring[],col1,col2,col3)
{
    if(
IsPlayerConnected(playerid))
    {
        new 
Float:posxFloat:posyFloat:posz;
        new 
Float:oldposxFloat:oldposyFloat:oldposz;
        new 
Float:tempposxFloat:tempposyFloat:tempposz;
        
GetPlayerPos(playeridoldposxoldposyoldposz);
        for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i))
            {
                if(
GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
                {
                    
GetPlayerPos(iposxposyposz);
                    
tempposx = (oldposx -posx);
                    
tempposy = (oldposy -posy);
                    
tempposz = (oldposz -posz);
                    if (((
tempposx radi/16) && (tempposx > -radi/16)) && ((tempposy radi/16) && (tempposy > -radi/16)) && ((tempposz radi/16) && (tempposz > -radi/16)))
                    {
                        
SendClientMessage(icol1string);
                    }
                    else if (((
tempposx radi/8) && (tempposx > -radi/8)) && ((tempposy radi/8) && (tempposy > -radi/8)) && ((tempposz radi/8) && (tempposz > -radi/8)))
                    {
                        
SendClientMessage(icol2string);
                    }
                    else if (((
tempposx radi/4) && (tempposx > -radi/4)) && ((tempposy radi/4) && (tempposy > -radi/4)) && ((tempposz radi/4) && (tempposz > -radi/4)))
                    {
                        
SendClientMessage(icol3string);
                    }
                    }
                }
        }
    }
    return 
true;
}  


В конец мода:

Code: Select all

forward ClearAnim(playerid);
public 
ClearAnim(playerid)
{
ClearAnimations(playerid);
return 
1;
}
public 
Gamburger(playerid) return ClearAnimations(playerid);  
Image

! ! !


Return to “Уроки”

Who is online (over the past 5 minutes)

Users browsing this forum: 2 guests