Hello There, Guest! Login or Register


[Idea/Script] Anti Fake Car Entry (No! it doesn't ban you!)
#1
Hello LVP,

Today when i was fighting against random players, with low health i tried to run away. In order to do that i did a fake car entry and during it i typed /house goto(well i succeed in it). I got reported for such abuse. Then an admin questioned me if i did this, i told that i feel ashamed for what have i done. 
Well, he banned me for 3 days.

Isn't it kinda obnoxious that you ban a regular player on a fake car entry thing? For me, Yes! it is.

Than i came across whith this idea that its better to suggest the dev's about anti fake car entry. Than i scripted it and tested it.

Explanation of the idea/script: When you shoot/or get shot than try to enter car it clears your animation and moves you back to your position. This check only stands for 10 seconds.
 
The script:
Code:
#include <a_samp>

#define     HIT_TIME     10      //Seconds: Can be increased as dev's wish.

new
    MadeWeaponShot[MAX_PLAYERS],
    TookDamage[MAX_PLAYERS];

main(){}
public OnGameModeInit()
{
    SetTimer("OnScriptUpdate",1000,true);
}

forward OnScriptUpdate();
public OnScriptUpdate()
{
    for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
   {
        if(IsInFight(i))
        {
            if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_ENTER_VEHICLE)
            {
                ClearAnimations(i); // clear the animations

                new Float:pos[3];
                GetPlayerPos(i, pos[0], pos[1], pos[2]);
                SetPlayerPos(i, pos[0], pos[1], pos[2] + 3); // Just making sure that player is stunned.

                SendClientMessage(i, 0xff9900FF, "** You can't enter in a car while you are in a fight or fired a weapon!");
            }
        }
   }
    return 1;
}

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    MadeWeaponShot[playerid] = gettime(); // Saving it in a variable
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        TookDamage[playerid] = gettime(); // Saving it in a variable
    }
    return 1;
}

stock IsInFight(playerid) // to check as if player is in fight or not
{
    if(gettime() - MadeWeaponShot[playerid] < HIT_TIME) return 1;
    if(gettime() - TookDamage[playerid] < HIT_TIME) return 1;

    return 0;
}

Preview of how the script works:

Credits: [BB]weeknd | For making the video
Reply


Messages In This Thread
[Idea/Script] Anti Fake Car Entry (No! it doesn't ban you!) - by Starboy - 06-12-2017, 09:46 PM