Jump to content
View in the app

A better way to browse. Learn more.

Forum Supreme-Elite

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Steven peut te le faire en 5min si c'est de ce pote que tu parle. Sinon previens au maximum le dimanche a 20h si c'est pas fait. 

  • Author

Oui c'est bien Steven, mais pour l'instant j'évite de lui mendier de trop, j'me suis un peu barré des nsnf en fourbe quand le jailrp a fermé xD

Par contre je need un serveur de test sur css pour tester différente fonction auxquelles, j'ai un doute sur l'utilisation de celle ci

j'essaye de pécho mon ordinateur ce soir. Compliqué en ce moment, j'ai le temps de rien faire ^^

Test ça, j'ai jamais rien compris au triggers donc je promais rien.

#include<sdktools>

new bool:g_bAlredyTouch[MAXPLAYERS+1];

public OnClientPutInServer(client)
{
    g_bAlredyTouch[client] = false;
}

public OnPluginStart()
{
    HookEntityOutput("trigger_resize", "OnStartTouch",OnStartTouch);
    HookEvent("player_spawn", Event_PlayerSpawn);
}

public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
    if(!IsPlayer(client))
        return Plugin_Handled;
    if(!IsClientInGame(client))
        return Plugin_Handled;
    if(!IsPlayerAlive(client))
        return Plugin_Handled;
        
    SetClientSize(client, 1.0);
    
    return Plugin_Handled;
}

public OnStartTouch(const String:output[], caller, activator, Float:delay)
{
    if(!IsPlayer(activator))
        return;
    if(!IsClientInGame(activator))
        return;
    if(!IsPlayerAlive(activator))
        return;
    
    if(g_bAlredyTouch[activator])
    {
        SetClientSize(activator, 1.0);
        g_bAlredyTouch[activator] = false;
    }
    if(!g_bAlredyTouch[activator])
    {
        SetClientSize(activator, 0.5);
        g_bAlredyTouch[activator] = true;
    }
}

stock bool:IsPlayer(client)
{
    return (client > 0 && client <= MAXPLAYERS);
}

stock SetClientSize(client, Float:size)
{
    SetEntPropFloat(client, Prop_Send, "m_flModelScale", size);
}

Si non test celui la (Je le pense plus logique ^^)

#include <sdktools>

new bool:g_bAlredyTouch[MAXPLAYERS+1];

public OnClientPutInServer(client)
{
    g_bAlredyTouch[client] = false;
}

public OnPluginStart()
{
    HookEvent("round_start", Event_RoundStart);
    HookEvent("player_spawn", Event_PlayerSpawn);
}

public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
    if(!IsPlayer(client))
        return Plugin_Handled;
    if(!IsClientInGame(client))
        return Plugin_Handled;
    if(!IsPlayerAlive(client))
        return Plugin_Handled;
        
    SetClientSize(client, 1.0);
    
    return Plugin_Handled;
}

public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    new index = -1;
    new String:sTargetName[32];
    while ((index = FindEntityByClassname(index, "trigger_multiple")) != -1)
    {
        GetTargetName(index, sTargetName, sizeof(sTargetName));

        if(StrEqual(sTargetName, "trigger_resize"))
        {
            HookSingleEntityOutput(index, "OnStartTouch", OnStartTouch);
        }
    }
}

public OnStartTouch(const String:output[], caller, activator, Float:delay)
{
    if(!IsPlayer(activator))
        return;
    if(!IsClientInGame(activator))
        return;
    if(!IsPlayerAlive(activator))
        return;
    
    if(g_bAlredyTouch[activator])
    {
        SetClientSize(activator, 1.0);
        g_bAlredyTouch[activator] = false;
    }
    if(!g_bAlredyTouch[activator])
    {
        SetClientSize(activator, 0.5);
        g_bAlredyTouch[activator] = true;
    }
}

stock bool:IsPlayer(client)
{
    return (client > 0 && client <= MAXPLAYERS);
}

stock SetClientSize(client, Float:size)
{
    SetEntPropFloat(client, Prop_Send, "m_flModelScale", size);
}

stock GetTargetName(entity, String:buffer[], maxlen)
{
    GetEntPropString(entity, Prop_Data, "m_iName", buffer, maxlen);
}

Appelle tes triggers : trigger_resize

Le deuxième à l'air plus correct.

 

Tu auras plus de chance de me contacter sur steam ;)

Edited by kriax

  • Author

Donc je ne donne meme pas de nom au trigger, je crée juste une zone avec comme entité "trigger_resize" c'est bien ça ?

Dans le pluggin que tu as créé, je dois installer au préalable le pluggin qui resize également ?

Qu'est ce que ton pluggin fait donc précisement ?

 

D'acc je vois steam

Je te dirais de prendre le deuxième.

 

En gros, il "scan" tout les trigger_multiple.

Je sais pas à quoi ça correspond réellement enfait.

Le trigger_multiple qui à comme nom "m_iName" trigger_resize bah je le "touche".

 

Donc pour bien faire tu devrais créé un trigger_multiple et lui attribuer comme "m_iName" trigger_resize.

 

Le joueur de base à la taille "1.0", la première fois qu'il vas toucher trigger_resize il auras la taille 0.5, la deuxième fois 1.0.

 

La variable boolan g_bAlreadyTouch se met sur vrais quand il est petit, et sur faux quand il est grand.

Donc tout se joue sur le plugin, tu n'as juste à attribuer ton trigger_multiple la ou il faut.

 

D'un point de vue logique ça fonctionne, techniquement je sais pas, on verras demain car la je coupe le pc :P

  • Author

D'accord bah je testerai ca sur un serveur bientôt; si ca marche on verra pour lui ajouter plus d'option de taille ^^

Bah si sa fonctionne dit le moi et je verais pour l'adapter en fonction de ta map ^^

Je suis pas du genre à aider les autres team, mais j'ai eu beaucoup d'écho comme quoi on parle en bien de mon serveur murder sur vos serveurs à vous donc j'essaye de remercier un peu les SE ^^

 

Kriax.

  • Author

Bah même moi j'en ai entendu parler, beaucoup de joueur y jouent ^^

Bah voilà ^^

Ca fais un petit peu de pub non volontaire donc je vous aide à mon tour ^^

Je t'en prie, en cas de soucis : kriax1995 t'as mon Steamamis, je passe pas tout les jours sur votre forum ^^

Si je peu aider ca me conviens :$

  • Author

Si tu as le time, pourrais tu rajouter plusieurs choses:

Lorsque un joueur quitte le trigger, (OnEndTouch) il recupere une taille normal (ca permettra que si un mec meurt dedans, il respawn a une taille normal.

Et puis rajouter plusieurs type, je ne sais pas de combien il est retrecit, mais il me faudrait plusieurs possible

Une taille de 30%, 50%

150% 200%

(Donc des noms de trigger different)

Si tu n'as pas le temps je comprendrais, poney s' en chargera, mais il boss sur d'autre chose en ce moment ^^

Le fait qu'un joueur meurt retrouve sa taille normale au début du prochain round est déjà géré dans le hook Event_PlayerSpawn.

 

Sinon Kriax, tu utilise que sdktools comme include pour cette version ? Je n'arrive pas à compiler car il ne trouve pas certaines fonctions (dont OnStartTouch(), IsPlayer()...). Elles sont pas dans l'API de sourcemod, dans quelle include elles sont déclarées ?

 

Je tente de modifier pour avoir plusieurs trigger de gérés mais sans l'include je ne peux compiler.

 

Edit : lol j'viens de tilter qu'elle était à la fin du code j'suis bigleux.

Edited by Fankine

Deuxième avec le code, explications en dessous.

#include <sdktools>

new bool:g_bAlreadyTouch[MAXPLAYERS+1];
new String:sTargetName[32];

public OnClientPutInServer(client)
{
    g_bAlreadyTouch[client] = false;
}

public OnPluginStart()
{
    HookEvent("round_start", Event_RoundStart);
    HookEvent("player_spawn", Event_PlayerSpawn);
}

public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
    if(!IsPlayer(client))
        return Plugin_Handled;
    if(!IsClientInGame(client))
        return Plugin_Handled;
    if(!IsPlayerAlive(client))
        return Plugin_Handled;
        
    SetClientSize(client, 1.0);
    
    return Plugin_Handled;
}


public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    new index = -1;
    
    while ((index = FindEntityByClassname(index, "trigger_multiple")) != -1)
    {
        GetTargetName(index, sTargetName, sizeof(sTargetName));

        if(StrContains(sTargetName, "trigger_resize_") != -1 )
        {
            HookSingleEntityOutput(index, "OnStartTouch", OnStartTouch);
        }
		
}

public OnStartTouch(const String:output[], caller, activator, Float:delay)
{
    if(!IsPlayer(activator))
        return;
    if(!IsClientInGame(activator))
        return;
    if(!IsPlayerAlive(activator))
        return;
    
    if(g_bAlreadyTouch[activator])
    {
        SetClientSize(activator, 1.0);
        g_bAlreadyTouch[activator] = false;
    }
    if(!g_bAlreadyTouch[activator] && StrEqual(sTargetName, "trigger_resize_small"))
    {
        SetClientSize(activator, 0.5);
        g_bAlreadyTouch[activator] = true;
    }
	if(!g_bAlreadyTouch[activator] && StrEqual(sTargetName, "trigger_resize_tiny"))
    {
        SetClientSize(activator, 0.3);
        g_bAlreadyTouch[activator] = true;
    }
	if(!g_bAlreadyTouch[activator] && StrEqual(sTargetName, "trigger_resize_big"))
    {
        SetClientSize(activator, 1.5);
        g_bAlreadyTouch[activator] = true;
    }
	if(!g_bAlreadyTouch[activator] && StrEqual(sTargetName, "trigger_resize_giant"))
    {
        SetClientSize(activator, 2);
        g_bAlreadyTouch[activator] = true;
    }
}



stock bool:IsPlayer(client)
{
    return (client > 0 && client <= MAXPLAYERS);
}

stock SetClientSize(client, Float:size)
{
    SetEntPropFloat(client, Prop_Send, "m_flModelScale", size);
}

stock GetTargetName(entity, String:buffer[], maxlen)
{
    GetEntPropString(entity, Prop_Data, "m_iName", buffer, maxlen);
}

Bon c'est complètement dégueulasse ce que j'ai fait (Salut le string en variable globale et salut la chaîne de if) mais bon on s'en tape ça devrais fonctionner.

 

En gros tu as maintenant 4 noms de trigger en fonction de la taille que tu veux.

trigger_resize_tiny = 30% de la taille normale

trigger_resize_small = 50%

trigger_resize_big = 150%

trigger_resize_giant = 200%

 

J'te laisse tester avec poney.

C'est simple tu copie un des if dans la fonction OnStartTouch() et tu modifie le nom du trigger (attention le nom du trigger doit commencer obligatoirement par "trigger_resize_") et tu modifie en dessous dans SetClientSize la valeur float par celle que tu veux (1 étant 100% :) ).

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...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.