Jump to content
News ticker
  • Bienvenue sur le nouveau forum VeryGames
  • Welcome to the new VeryGames forum
  • VeryNews

    Partage : Rush Deagle


    Azik

    Recommended Posts

    Salut à vous,

     

    Voici un plugin qui permet aux deux équipes de rush un point à un autre, sinon on est slay.

     

    Voici le code :

    #include <sourcemod>
    #include <sdktools>
    #include <morecolors>
    
    new bool:Reached[MAXPLAYERS+1] = false;
    new Timer[MAXPLAYERS+1] = 0;
    new Handle:TimerCheck[MAXPLAYERS+1] = INVALID_HANDLE;
    
    #define LOGO "{turquoise}[Rush]{gold}"
    
    public OnPluginStart()
    {
           HookEvent("player_death", OnPlayerDeath);
           HookEvent("player_spawn", Event_PlayerSpawn);
    }
    
    public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
    {
           new UserId = GetEventInt(event, "userid");
           new client = GetClientOfUserId(UserId);
    
           TrashTimer(client);
           LunchTimer(client);    
    }
    
    public OnPlayerDeath(Handle:event, String:name[], bool:DontBroadCast)
    {
       new client = GetClientOfUserId(GetEventInt(event, "userid"));
       TrashTimer(client);
    }
    
    LunchTimer(client)
    {
           Timer[client] = 17;
           TimerCheck[client] = CreateTimer(1.0, TimerCheckIn, client, TIMER_REPEAT);
    }
    
    TrashTimer(client)
    {
           if (TimerCheck[client] != INVALID_HANDLE)
           {
                   KillTimer(TimerCheck[client]);
                   TimerCheck[client] = INVALID_HANDLE;
           }
    }
    
    public Action:TimerCheckIn(Handle:timer, any:client)
    {
       if(IsClientInGame(client) && IsPlayerAlive(client))
       {
                   if (Timer[client] > 0)
                   {
                           Timer[client] -= 1;
                           Hud(client, Timer[client]);
                           if(Timer[client] == 0)
                           {
                                   if(!Reached[client])
                                   {
                                           ForcePlayerSuicide(client);
                                           CPrintToChat(client, "%s Vous n'avez pas réussi à atteindre le spawn adverse.", LOGO);
                                   }
                           }
    
                           if(GetClientTeam(client) == 2)
                           {
                                   if(IsInCt(client))
                                   {
                                           if(!Reached[client])
                                           {
                                                   Reached[client] = true;
                                                   CPrintToChat(client, "%s Vous avez atteint le spawn adverse, vous êtes libre.", LOGO);
                                           }
                                   }
                           }
                           else if(GetClientTeam(client) == 3)
                           {
                                   if(IsInTerro(client))
                                   {
                                           if(!Reached[client])
                                           {
                                                   Reached[client] = true;
                                                   CPrintToChat(client, "%s Vous avez atteint le spawn adverse, vous êtes libre.", LOGO);
                                           }
                                   }
                           }
                   }
                   else
                   {
                           TrashTimer(client);
                   }
       }
    }
    
    stock Hud(client, sec)
    {
           decl String:szText[1024];
           if(!Reached[client])
                   Format(szText, sizeof(szText), "Il vous reste %i secondes\nPour rusher le spawn adverse !", sec);
           else
                   Format(szText, sizeof(szText), "Félicitations il vous avez atteint\nLe spawn adverse ! Bon round");
           new Handle:hBuffer = StartMessageOne("KeyHintText", client);
           BfWriteByte(hBuffer, 1);
           BfWriteString(hBuffer, szText);
           EndMessage();
    }
    
    public OnClientDisconnect(client)
    {
           TrashTimer(client);
    }
    
    public bool:IsInTerro(client)
    {
       new Float:vec[3];
       GetEntPropVector(client, Prop_Send, "m_vecOrigin", vec);
       if (vec[0] >= -947.968750 && vec[0] <= 894.968750 && vec[1] >= 512.895386 && vec[1] <= 889.968750 && vec[2] >= 0.031250 && vec[2] <= 371.031250)
           return true;
    
       return false;
    }
    
    public bool:IsInCt(client)
    {
       new Float:vec[3];
       GetEntPropVector(client, Prop_Send, "m_vecOrigin", vec);
       if (vec[0] >= -942.291382 && vec[0] <= 865.654724 && vec[1] >= -1135.968750 && vec[1] <= -771.067749 && vec[2] >= 0.031250 && vec[2] <= 371.031250)
           return true;
    
       return false;
    }
    

     

    Il marche sur la map : aim_deagle7k.bsp mais peut être modifiable depuis le code source.

     

    Cordialement,

    Link to comment
    Share on other sites

    [color=#333333]#include <sourcemod>[/color]#include <sdktools>
    #include <morecolors>
    
    public Plugin:myinfo =
    {
       name = "Rush Deagel",
       author = "@lex92 & Kriax",
    };
    
    new bool:Reached[MAXPLAYERS+1] = false;
    new Timer[MAXPLAYERS+1] = 0;
    new Handle:TimerCheck[MAXPLAYERS+1] = INVALID_HANDLE;
    
    #define LOGO "{turquoise}[Rush]{gold}"
    
    public OnPluginStart()
    {
           HookEvent("player_death", OnPlayerDeath);
           HookEvent("player_spawn", Event_PlayerSpawn);
    }
    
    public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
    {
           new UserId = GetEventInt(event, "userid");
           new client = GetClientOfUserId(UserId);
    
           TrashTimer(client);
           LunchTimer(client);    
    }
    
    public OnPlayerDeath(Handle:event, String:name[], bool:DontBroadCast)
    {
       new client = GetClientOfUserId(GetEventInt(event, "userid"));
       TrashTimer(client);
    }
    
    LunchTimer(client)
    {
           Timer[client] = 17;
           TimerCheck[client] = CreateTimer(1.0, TimerCheckIn, client, TIMER_REPEAT);
    }
    
    TrashTimer(client)
    {
           if (TimerCheck[client] != INVALID_HANDLE)
           {
                   KillTimer(TimerCheck[client]);
                   TimerCheck[client] = INVALID_HANDLE;
           }
    }
    
    public Action:TimerCheckIn(Handle:timer, any:client)
    {
       if(IsClientInGame(client) && IsPlayerAlive(client))
       {
                   if (Timer[client] > 0)
                   {
                           Timer[client] -= 1;
                           Hud(client, Timer[client]);
                           if(Timer[client] == 0)
                           {
                                   if(!Reached[client])
                                   {
                                           ForcePlayerSuicide(client);
                                           CPrintToChat(client, "%s Vous n'avez pas réussi à atteindre le spawn adverse.", LOGO);
                                   }
                           }
    
                           if(GetClientTeam(client) == 2)
                           {
                                   if(IsInCt(client))
                                   {
                                           if(!Reached[client])
                                           {
                                                   Reached[client] = true;
                                                   CPrintToChat(client, "%s Vous avez atteint le spawn adverse, vous êtes libre.", LOGO);
                                           }
                                   }
                           }
                           else if(GetClientTeam(client) == 3)
                           {
                                   if(IsInTerro(client))
                                   {
                                           if(!Reached[client])
                                           {
                                                   Reached[client] = true;
                                                   CPrintToChat(client, "%s Vous avez atteint le spawn adverse, vous êtes libre.", LOGO);
                                           }
                                   }
                           }
                   }
                   else
                   {
                           TrashTimer(client);
                   }
       }
    }
    
    stock Hud(client, sec)
    {
           decl String:szText[1024];
           if(!Reached[client])
                   Format(szText, sizeof(szText), "Il vous reste %i secondes\nPour rusher le spawn adverse !", sec);
           else
                   Format(szText, sizeof(szText), "Félicitations il vous avez atteint\nLe spawn adverse ! Bon round");
           new Handle:hBuffer = StartMessageOne("KeyHintText", client);
           BfWriteByte(hBuffer, 1);
           BfWriteString(hBuffer, szText);
           EndMessage();
    }
    
    public OnClientDisconnect(client)
    {
           TrashTimer(client);
    }
    
    public bool:IsInTerro(client)
    {
       new Float:vec[3];
       GetEntPropVector(client, Prop_Send, "m_vecOrigin", vec);
       if (vec[0] >= -947.968750 && vec[0] <= 894.968750 && vec[1] >= 512.895386 && vec[1] <= 889.968750 && vec[2] >= 0.031250 && vec[2] <= 371.031250)
           return true;
    
       return false;
    }
    
    public bool:IsInCt(client)
    {
       new Float:vec[3];
       GetEntPropVector(client, Prop_Send, "m_vecOrigin", vec);
       if (vec[0] >= -942.291382 && vec[0] <= 865.654724 && vec[1] >= -1135.968750 && vec[1] <= -771.067749 && vec[2] >= 0.031250 && vec[2] <= 371.031250)
           return true;
    
       return false; [color=#333333]}[/color]

    Link to comment
    Share on other sites

    • 2 weeks later...

    Bonjour,

    J'ai testé votre script "Rush Deagle" sur mon serveur avec la mail aim_deage7k

     

    Le script fonctionne parfaitement bien le 1er round. Malheureusement les rounds suivants, il n'affiche que la phrase "Félicitations vous avez atteint le spawn adverse ! Bon round"

     

    Le timer ne redémarre pas au round suivant.

     

    Pouvez vous m'apporter votre aide ?! Merci d'avance

     

    John

    Link to comment
    Share on other sites

    • 1 month later...

    Version débugué , By Miew.

     

    #include <sourcemod>
    #include <sdktools>
    #include <smlib>
    
    new bool:Reached[MAXPLAYERS+1] = { false, ... };
    
    new iTime[MAXPLAYERS+1];
    
    new Handle:g_hTimerSpawn[MAXPLAYERS+1] = { INVALID_HANDLE, ...};
    new Handle:g_hTime;
    
    new String:Map_Name[64];
    
    public OnMapStart()
    {
    GetCurrentMap(Map_Name, sizeof(Map_Name));
    }
    
    public OnPluginStart()
    {
    HookEvent("player_spawn", OnPlayerSpawn_Callback);
    HookEvent("player_death", OnPlayerDeath_Callback);
    HookEvent("round_end", OnRoundEnd_Callback);
    
    g_hTime = CreateConVar("temps",
    "17",
    "temps pr atteindre le spawn",
    _,
    true, 
    10.0,
    true, 
    17.0);
    
    AutoExecConfig(true, "deagle_rush");
    }
    
    public OnPlayerSpawn_Callback(Handle:event, const String:name[], bool:dontBroadcast)
    {
    if(StrEqual("aim_deagle7k",Map_Name,false))
    {
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
    Reached[client] = false;
    iTime[client] = GetConVarInt(g_hTime);
    
    if(g_hTimerSpawn[client] == INVALID_HANDLE )
    g_hTimerSpawn[client] = CreateTimer(1.0, timer_callback, client, TIMER_REPEAT);
    }
    }
    
    public Action:timer_callback(Handle:timer, any:client)
    {
    if( IsClientInGame(client) && IsPlayerAlive(client) )
    {
    if(iTime[client] > 0)
    iTime[client] -= 1;
    
    if( GetClientTeam(client) == 3 && IsInTerro(client) && iTime[client] > 0 )
    {
    Client_PrintKeyHintText(client, "Félicitations vous avez atteint\nLe spawn Terro ! Bon round");
    Reached[client] = true;
    }
    
    else if( GetClientTeam(client) == 2 && IsInCt(client) && iTime[client] > 0)
    {
    Client_PrintKeyHintText(client, "Félicitations vous avez atteint\nLe spawn CT ! Bon round");
    Reached[client] = true;
    }
    
    else if( Reached[client] == false)
    {
    Client_PrintKeyHintText(client, "Dépèche toi! , il ne te reste plus que %i secondes pour atteindre le spawn !", iTime[client]);
    
    if(iTime[client] <= 0)
    {
    ForcePlayerSuicide(client);
    if(g_hTimerSpawn[client] != INVALID_HANDLE )
    {
    CloseHandle(g_hTimerSpawn[client]);
    g_hTimerSpawn[client]= INVALID_HANDLE;
    }
    }
    }
    }
    }
    
    public OnPlayerDeath_Callback(Handle:event, const String:name[], bool:dontBroadcast)
    {
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
    if(g_hTimerSpawn[client] != INVALID_HANDLE )
    {
    CloseHandle(g_hTimerSpawn[client]);
    g_hTimerSpawn[client]= INVALID_HANDLE;
    }
    }
    
    public OnRoundEnd_Callback(Handle:event, const String:name[], bool:dontBroadcast)
    {
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
    if(g_hTimerSpawn[client] != INVALID_HANDLE )
    {
    CloseHandle(g_hTimerSpawn[client]);
    g_hTimerSpawn[client]= INVALID_HANDLE;
    }
    }
    
    public OnMapEnd()
    {
    for(new i = 1; i<=MaxClients; i++)
    {
    if(g_hTimerSpawn[i] != INVALID_HANDLE )
    {
    CloseHandle(g_hTimerSpawn[i]);
    g_hTimerSpawn[i]= INVALID_HANDLE;
    }
    }
    }
    
    public OnClientDisconnect(client)
    {
    if(g_hTimerSpawn[client] != INVALID_HANDLE )
    {
    CloseHandle(g_hTimerSpawn[client]);
    g_hTimerSpawn[client]= INVALID_HANDLE;
    }
    }
    
    stock bool:IsInTerro(client)
    {
    new Float:vec[3];
    GetEntPropVector(client, Prop_Send, "m_vecOrigin", vec);
    if (vec[0] >= -947.968750 
    && vec[0] <= 894.968750 
    && vec[1] >= 512.895386 
    && vec[1] <= 889.968750 
    && vec[2] >= 0.031250 
    && vec[2] <= 371.031250)return true;
    else
    return false;
    }
    
    stock bool:IsInCt(client)
    {
    new Float:vec[3];
    GetEntPropVector(client, Prop_Send, "m_vecOrigin", vec);
    if (vec[0] >= -942.291382 
    && vec[0] <= 865.654724 
    && vec[1] >= -1135.968750 
    && vec[1] <= -771.067749 
    && vec[2] >= 0.031250 
    && vec[2] <= 371.031250)return true;
    else
    return false;
    }
    

    Link to comment
    Share on other sites

    Bah, pas propre et pas opti :$

     

    public OnRoundEnd_Callback(Handle:event, const String:name[], bool:dontBroadcast)
    {
       new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
       if(g_hTimerSpawn[client] != INVALID_HANDLE )
       {
           CloseHandle(g_hTimerSpawn[client]);
           g_hTimerSpawn[client]= INVALID_HANDLE;
       }
    }
    

     

    Big Connerie :$

    [TABLE=class: ent]

    [TR]

    [TD=class: et2th] Name:[/TD]

    [TD=class: et2td] round_end[/TD]

    [/TR]

    [TR]

    [TD=class: et2th] Structure:[/TD]

    [TD=class: et2td] [TABLE=class: ent]

    [TR]

    [TD=class: et2th] byte [/TD]

    [TD=class: et2td] winner[/TD]

    [TD=class: et2td] winner team/user id[/TD]

    [/TR]

    [TR]

    [TD=class: et2th] byte[/TD]

    [TD=class: et2td] reason[/TD]

    [TD=class: et2td] reason why the team won[/TD]

    [/TR]

    [TR]

    [TD=class: et2th] string[/TD]

    [TD=class: et2td] message[/TD]

    [TD=class: et2td] end round message[/TD]

    [/TR]

    [/TABLE]

    [/TD]

    [/TR]

    [/TABLE]

    Link to comment
    Share on other sites

    • 3 months later...

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...