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

Описание: Уроки по скриптингу
Модератор: SJplayer

SJplayer M
Автор темы, Модератор
Модератор
Аватара
SJplayer M
Автор темы, Модератор
Модератор
Сообщения: 196
Зарегистрирован: 25 мая 2013
С нами: 10 лет 10 месяцев

#1 SJplayer » 1 июля 2013, 19:38

Tazer при выстреле с 9mm
Автор: Неизвестный

Ко всем define:

Код: Выделить всё

#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:

Код: Выделить всё

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


Ко всем forward:

Код: Выделить всё

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


В паблик onplayerconnect:

Код: Выделить всё

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


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

Код: Выделить всё

public DestroySpark(playerid

        
DestroyObject(Spark[playerid]); 
        return 
1


public 
TazedRemove(playerid

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


В паблик OnPlayerGiveDamage:

Код: Выделить всё

 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); 
        }  


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

Код: Выделить всё

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 , тогда создаем:

Код: Выделить всё

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
}  


В конец мода:

Код: Выделить всё

forward ClearAnim(playerid); 
public 
ClearAnim(playerid

ClearAnimations(playerid); 
return 
1

public 
Gamburger(playerid) return ClearAnimations(playerid); 


LILU M
Подполковник
Подполковник
Аватара
LILU M
Подполковник
Подполковник
Сообщения: 468
Зарегистрирован: 5 апреля 2013
С нами: 11 лет

#2 LILU » 6 июля 2013, 21:23

Нормально +


Вернуться в «Уроки»

Кто сейчас на форуме (по активности за 5 минут)

Сейчас этот раздел просматривают: 2 гостя