How do players crippled in the car
#1

These are my scripts if anyone knows how to help me.

Code :

Quote:

CMD:tazer(playerid, params[])
{
if(HungerPlayerInfo[playerid][hgInEvent] != 0) return SendClientMessageEx(playerid, COLOR_GREY, " Ban khong the lam dieu nay khi dang tham gia su kien Hunger Games!");
#if defined zombiemode
if(zombieevent == 1 && GetPVarType(playerid, "pIsZombie")) return SendClientMessageEx(playerid, COLOR_GREY, "Zombies khong the su dung.");
#endif
if(IsACop(playerid))
{
new string[128];
if(PlayerInfo[playerid][pConnectHours] < 2 || PlayerInfo[playerid][pWRestricted] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong the lay sung dien, ban dang bi han che vu khi!");

if(GetPVarInt(playerid, "IsInArena") >= 0)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Ban khong the lam dieu nay bay gio, ban dang trong arena!");
return 1;
}
if(GetPVarInt( playerid, "EventToken") != 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the lam dieu nay khi dang tham gia su kien.");
return 1;
}
if(PlayerCuffedTime[playerid] > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the lam dieu nay bay gio.");
return 1;
}
if(GetPVarInt(playerid, "Injured") == 1)
{
SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the lam dieu nay bay gio.");
return 1;
}

if(PlayerInfo[playerid][pJailTime] > 0)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Ban khong the lam dieu nay trong tu.");
return 1;
}
if(PlayerCuffed[playerid] >= 1) {
SendClientMessageEx(playerid, COLOR_WHITE, "Ban khong the lam dieu nay bay gio.");
return 1;
}
if(PlayerInfo[playerid][pHasTazer] < 1)
{
SendClientMessage(playerid, COLOR_WHITE, "Ban khong co sung dien!");
return 1;
}

if(pTazer{playerid} == 0)
{
pTazerReplace{playerid} = PlayerInfo[playerid][pGuns][2];
if(PlayerInfo[playerid][pGuns][2] != 0) RemovePlayerWeapon(playerid, PlayerInfo[playerid][pAmmo][2]);
format(string, sizeof(string), "* %s lay khau sung dien ra.", GetPlayerNameEx(playerid));
ProxDetector(4.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
GivePlayerValidWeapon(playerid, 23, 60000);
pTazer{playerid} = 1;
}
else
{
RemovePlayerWeapon(playerid, 23);
GivePlayerValidWeapon(playerid, pTazerReplace{playerid}, 0);
format(string, sizeof(string), "* %s cat khau sung dien vao.", GetPlayerNameEx(playerid));
ProxDetector(4.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
pTazer{playerid} = 0;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, " Ban khong phai la nhan vien chinh phu!");
return 1;
}
return 1;
}

Code :

Quote:

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
if (damagedid == INVALID_PLAYER_ID) return 1;
if (playerid == INVALID_PLAYER_ID) return 1;

if(pTazer{playerid} == 1)
{
if(weaponid != 23) {
new string[44 + MAX_PLAYER_NAME];
RemovePlayerWeapon(playerid, 23);
GivePlayerValidWeapon(playerid, pTazerReplace{playerid}, 60000);
format(string, sizeof(string), "* %s holsters their tazer.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
pTazer{playerid} = 0;
return 1;
}
if(!ProxDetectorS(20.0, playerid, damagedid)) {
new string[44 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s fires their tazer at %s, missing them.", GetPlayerNameEx(playerid), GetPlayerNameEx(damagedid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
return 1;
}
if(TazerTimeout[playerid] > 0 && !GetPVarType(damagedid, "IsFrozen"))
{
new Float:hp;
GetPlayerHealth(damagedid, hp);
SetPlayerHealth(damagedid, hp-amount);
return 1;
}
if(GetPlayerState(damagedid) == PLAYER_STATE_ONFOOT && PlayerCuffed[damagedid] == 0 && PlayerInfo[playerid][pHasTazer] == 1)
{
if(PlayerInfo[damagedid][pAdmin] >= 2 && PlayerInfo[damagedid][pTogReports] != 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Admin khong the bi tazer!");
new Float:hp;
GetPlayerHealth(damagedid, hp);
SetPlayerHealth(damagedid, hp+amount);
return 1;
}
#if defined zombiemode
if(GetPVarInt(damagedid, "pIsZombie"))
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Zombie khong the bi tazer!");
return 1;
}
#endif
new Float:X, Float:Y, Float:Z, Float:hp;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerHealth(damagedid, hp);
new string[44 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s da ban sung dien lam te liet %s .", GetPlayerNameEx(playerid), GetPlayerNameEx(damagedid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
GameTextForPlayer(damagedid, "~r~BeanBag", 3500, 3);
SetPlayerHealth(damagedid, hp+amount);
TogglePlayerControllable(damagedid, 0);
ApplyAnimation(damagedid,"PED","KO_skid_front",4.1 ,0,1,1,1,1,0);
PlayerPlaySound(damagedid, 1085, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
PlayerCuffed[damagedid] = 1;
SetPVarInt(damagedid, "PlayerCuffed", 1);
PlayerCuffedTime[damagedid] = 16;
SetPVarInt(damagedid, "IsFrozen", 1);
TazerTimeout[playerid] = 6;
SetTimerEx("TazerTimer",1000,false,"d",playerid);
}
}
return 1;
}

Reply
#2

I doubt people will read that if you don't state your problem!
Reply
#3

Quote:
Originally Posted by v1k1nG
Посмотреть сообщение
I doubt people will read that if you don't state your problem!
I mean, how do POLICE shoot guns while the players on the motorcycle are still paralyzed
Reply
#4

Even I'm not quite able to decipher this.

Are you meaning that when you are tazering people, they're not freezing as they should in the tazer effect?

Also, indentation is a good thing to do, it makes your code easier to read.

PHP код:
CMD tazer(playeridparams[])
{
    if(
HungerPlayerInfo[playerid][hgInEvent] != 0) return SendClientMessageEx(playeridCOLOR_GREY" Ban khong the lam dieu nay khi dang tham gia su kien Hunger Games!");
#if defined zombiemode
    
if(zombieevent == && GetPVarType(playerid"pIsZombie")) return SendClientMessageEx(playeridCOLOR_GREY"Zombies khong the su dung.");
#endif
    
if(IsACop(playerid))
    {
        new 
string[128];
        if(
PlayerInfo[playerid][pConnectHours] < || PlayerInfo[playerid][pWRestricted] > 0) return SendClientMessageEx(playeridCOLOR_GRAD2"Ban khong the lay sung dien, ban dang bi han che vu khi!");

        if(
GetPVarInt(playerid"IsInArena") >= 0)
        {
            
SendClientMessageEx(playeridCOLOR_WHITE"Ban khong the lam dieu nay bay gio, ban dang trong arena!");
            return 
1;
        }
        if(
GetPVarIntplayerid"EventToken") != 0)
        {
            
SendClientMessageEx(playeridCOLOR_GREY"Ban khong the lam dieu nay khi dang tham gia su kien.");
            return 
1;
        }
        if(
PlayerCuffedTime[playerid] > 0)
        {
            
SendClientMessageEx(playeridCOLOR_GREY"Ban khong the lam dieu nay bay gio.");
            return 
1;
        }
        if(
GetPVarInt(playerid"Injured") == 1)
        {
            
SendClientMessageEx(playeridCOLOR_GREY"Ban khong the lam dieu nay bay gio.");
            return 
1;
        }

        if(
PlayerInfo[playerid][pJailTime] > 0)
        {
            
SendClientMessageEx(playeridCOLOR_WHITE"Ban khong the lam dieu nay trong tu.");
            return 
1;
        }
        if(
PlayerCuffed[playerid] >= 1) {
            
SendClientMessageEx(playeridCOLOR_WHITE"Ban khong the lam dieu nay bay gio.");
            return 
1;
        }
        if(
PlayerInfo[playerid][pHasTazer] < 1)
        {
            
SendClientMessage(playeridCOLOR_WHITE"Ban khong co sung dien!");
            return 
1;
        }

        if(
pTazer {playerid} == 0)
        {
            
pTazerReplace {playerid} = PlayerInfo[playerid][pGuns][2];
            if(
PlayerInfo[playerid][pGuns][2] != 0RemovePlayerWeapon(playeridPlayerInfo[playerid][pAmmo][2]);
            
format(stringsizeof(string), "* %s lay khau sung dien ra."GetPlayerNameEx(playerid));
            
ProxDetector(4.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
            
GivePlayerValidWeapon(playerid2360000);
            
pTazer {playerid} = 1;
        }
        else
        {
            
RemovePlayerWeapon(playerid23);
            
GivePlayerValidWeapon(playeridpTazerReplace {playerid}, 0);
            
format(stringsizeof(string), "* %s cat khau sung dien vao."GetPlayerNameEx(playerid));
            
ProxDetector(4.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
            
pTazer {playerid} = 0;
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2" Ban khong phai la nhan vien chinh phu!");
        return 
1;
    }
    return 
1;

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloatamountweaponid)
{
    if (
damagedid == INVALID_PLAYER_ID) return 1;
    if (
playerid == INVALID_PLAYER_ID) return 1;

    if(
pTazer {playerid} == 1)
    {
        if(
weaponid != 23) {
            new 
string[44 MAX_PLAYER_NAME];
            
RemovePlayerWeapon(playerid23);
            
GivePlayerValidWeapon(playeridpTazerReplace {playerid}, 60000);
            
format(stringsizeof(string), "* %s holsters their tazer."GetPlayerNameEx(playerid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
            
pTazer {playerid} = 0;
            return 
1;
        }
        if(!
ProxDetectorS(20.0playeriddamagedid)) {
            new 
string[44 + (MAX_PLAYER_NAME 2)];
            
format(stringsizeof(string), "* %s fires their tazer at %s, missing them."GetPlayerNameEx(playerid), GetPlayerNameEx(damagedid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
            return 
1;
        }
        if(
TazerTimeout[playerid] > && !GetPVarType(damagedid"IsFrozen"))
        {
            new 
Float:hp;
            
GetPlayerHealth(damagedidhp);
            
SetPlayerHealth(damagedidhp-amount);
            return 
1;
        }
        if(
GetPlayerState(damagedid) == PLAYER_STATE_ONFOOT && PlayerCuffed[damagedid] == && PlayerInfo[playerid][pHasTazer] == 1)
        {
            if(
PlayerInfo[damagedid][pAdmin] >= && PlayerInfo[damagedid][pTogReports] != 1)
            {
                
SendClientMessageEx(playeridCOLOR_GRAD2"Admin khong the bi tazer!");
                new 
Float:hp;
                
GetPlayerHealth(damagedidhp);
                
SetPlayerHealth(damagedidhp+amount);
                return 
1;
            }
#if defined zombiemode
            
if(GetPVarInt(damagedid"pIsZombie"))
            {
                
SendClientMessageEx(playeridCOLOR_GRAD2"Zombie khong the bi tazer!");
                return 
1;
            }
#endif
            
new Float:XFloatYFloatZFloathp;
            
GetPlayerPos(playeridXYZ);
            
GetPlayerHealth(damagedidhp);
            new 
string[44 + (MAX_PLAYER_NAME 2)];
            
format(stringsizeof(string), "* %s da ban sung dien lam te liet %s ."GetPlayerNameEx(playerid), GetPlayerNameEx(damagedid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
            
GameTextForPlayer(damagedid"~r~BeanBag"35003);
            
SetPlayerHealth(damagedidhp+amount);
            
TogglePlayerControllable(damagedid0);
            
ApplyAnimation(damagedid,"PED","KO_skid_front",4.1,0,1,1,1,1,0);
            
PlayerPlaySound(damagedid1085XYZ);
            
PlayerPlaySound(playerid1085XYZ);
            
PlayerCuffed[damagedid] = 1;
            
SetPVarInt(damagedid"PlayerCuffed"1);
            
PlayerCuffedTime[damagedid] = 16;
            
SetPVarInt(damagedid"IsFrozen"1);
            
TazerTimeout[playerid] = 6;
            
SetTimerEx("TazerTimer",1000,false,"d",playerid);
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)