[HELP] Anti-Driveby == Jail
#1

Hi
This is maybe the last thing i ask about before ill take a break from scripting. (I will maybe ask about a bute thing later)

...
Lets say, When "ME" driveby "HIM" then "ME" auto jailed... but "HIM" get the 'jail time countdown' and "ME(who is in jail)" dont get the countdown text

pawn Код:
#include <a_samp>

new JCD, Counter = 120;
forward JailCountDown(playerid, killerid);
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    KillTimer(JCD);
    if(GetPlayerState(killerid) == 2)
    {
        if(!IsPlayerInAnyVehicle(playerid))
        {
            new playername[MAX_PLAYER_NAME];
            GetPlayerName(killerid, playername, sizeof(playername));
            new string[128];
            RemovePlayerFromVehicle(killerid);
            ResetPlayerWeapons(killerid);
            SetCameraBehindPlayer(killerid);
            SetPlayerInterior(killerid,3);
            SetPlayerPos(killerid,194.0873,175.3850,1003.0234);
            SetPlayerFacingAngle(killerid,20.7011);
            format(string, sizeof(string), "%s(%d) Do NOT Driveby",playername ,killerid);
            SendClientMessageToAll(0xFF7F50AA, string);

            JCD = SetTimer("JailCountDown", 1000, true);
            return 1;
        }
    }
    return 1;
}
pawn Код:
public JailCountDown(playerid, killerid)
{
    new string[128];
    Counter--;
    format(string, sizeof(string), "~DRIVEBY JAIL, TIME: %d",Counter);
    GameTextForPlayer(killerid, string, 3000,6);
    if(Counter == 0)
    {
        new killername[MAX_PLAYER_NAME];
        GetPlayerName(killerid, killername, sizeof(killername));
        SetPlayerInterior(killerid,3);
        SetPlayerPos(killerid,210.5272,146.3341,1003.0234);
        SetPlayerFacingAngle(killerid,179.4662);
        SetCameraBehindPlayer(killerid);

        format(string, sizeof(string), "%s(%d) Has been auto-released from Drivebyjail. Time Served: 120 seconds",killername ,killerid);
        SendClientMessageToAll(0xFF7F50AA, string);
        KillTimer(JCD);
    }
    return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(JCD);
    return 1;
}
Reply
#2

pawn Код:
#include <a_samp>

new JCD[YOUR_MAX_SLOTS],Counter[YOUR_MAX_SLOTS];
forward JailCountDown(killerid);


public OnPlayerDeath(playerid, killerid, reason)
{
    if(GetPlayerState(killerid) == 2)
    {
        if(!IsPlayerInAnyVehicle(playerid))
        {
            new playername[MAX_PLAYER_NAME];
            GetPlayerName(killerid, playername, sizeof(playername));
            new string[128];
            //RemovePlayerFromVehicle(killerid);
            ResetPlayerWeapons(killerid);
            SetCameraBehindPlayer(killerid);
            SetPlayerInterior(killerid,3);
            SetPlayerPos(killerid,194.0873,175.3850,1003.0234);
            SetPlayerFacingAngle(killerid,20.7011);
            format(string, sizeof(string), "%s(%d) Do NOT Driveby",playername ,killerid);
            SendClientMessageToAll(0xFF7F50AA, string);
            if(JCD[killerid]) KillTimer(JCD[killerid]);
            Counter[killerid]=seconds;
            JCD[killerid] = SetTimerEx("JailCountDown", 1000, true, "d", killerid);
            return 1;
        }
    }
    return 1;
}

public JailCountDown(killerid)
{
    new string[128];
    format(string, sizeof(string), "~DRIVEBY JAIL, TIME: %d",Counter[killerid]);
    GameTextForPlayer(killerid, string, 3000,6);
    Counter[killerid]--;
    if(!Counter[killerid])
    {
        new killername[MAX_PLAYER_NAME];
        GetPlayerName(killerid, killername, sizeof(killername));
        SetPlayerInterior(killerid,3);
        SetPlayerPos(killerid,210.5272,146.3341,1003.0234);
        SetPlayerFacingAngle(killerid,179.4662);
        SetCameraBehindPlayer(killerid);

        format(string, sizeof(string), "%s(%d) Has been auto-released from Drivebyjail. Time Served: 120 seconds",killername ,killerid);
        SendClientMessageToAll(0xFF7F50AA, string);
        KillTimer(JCD[killerid]);
        JCD[killerid]=0;
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(JCD[playerid]) KillTimer(JCD[playerid]);
    JCD[playerid]=0;
    return 1;
}
Reply
#3

Код:
#include <a_samp>
#define JAILTIME 5 //Minutes
new JCD[MAX_PLAYERS],Counter[MAX_PLAYERS];
forward JailCountDown(killerid);


public OnPlayerDeath(playerid, killerid, reason)
{
    if(GetPlayerState(killerid) == 2)
    {
        if(!IsPlayerInAnyVehicle(playerid))
        {
            new playername[MAX_PLAYER_NAME];
            GetPlayerName(killerid, playername, sizeof(playername));
            new string[128];
            //RemovePlayerFromVehicle(killerid);
            ResetPlayerWeapons(killerid);
            SetCameraBehindPlayer(killerid);
            SetPlayerInterior(killerid,3);
            SetPlayerPos(killerid,194.0873,175.3850,1003.0234);
            SetPlayerFacingAngle(killerid,20.7011);
            format(string, sizeof(string), "%s(%d) Do NOT Driveby",playername ,killerid);
            SendClientMessageToAll(0xFF7F50AA, string);
            if(JCD[killerid]) KillTimer(JCD[killerid]);
            Counter[killerid]=seconds;
            JCD[killerid] = SetTimerEx("JailCountDown", JAILTIME*1000, false, "d", killerid);
            return 1;
        }
    }
    return 1;
}
Use that. When you do your jail countdown, Just put the code to release the player.
E.X.
Код:
public JailCountDown(playerid)
{
   ReleasePlayer(playerid);
   return 1;
}
stock ReleasePlayer(playerid)
{
  SetPlayerPos(playerid,x,y,z);
  return 1;
}
Reply
#4

ERROR @ Jefff Version

pawn Код:
C:\Users\Lars Erik\Documents\SAMP Server\My server\filterscripts\AntiDriveby.pwn(3) : error 017: undefined symbol "YOUR_MAX_SLOTS"
C:\Users\Lars Erik\Documents\SAMP Server\My server\filterscripts\AntiDriveby.pwn(3) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Lars Erik\Documents\SAMP Server\My server\filterscripts\AntiDriveby.pwn(24) : error 017: undefined symbol "seconds"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)