Jump to content

Cum pot oprii comanda /fly pe buton [..]


FhenomenN

Recommended Posts

Heey, as dorii si eu sa opresc comanda FLY pe buton, adica pe F, daca ma ajutati, voi fii entuziasmat <3 Comanda: fly

CMD:fly(playerid)
{
    StartFly(playerid);
    SetPlayerHealth(playerid, 1000);
    SendClientMessage(playerid, COLOR_RED, "[Admin]: Flymode a fost activat.");
    return 1;
    
}

Comanda stopfly:
CMD:stopfly(playerid)
{
    StopFly(playerid);
    SetPlayerHealth(playerid, 100);
    SendClientMessage(playerid, COLOR_RED, "[Admin] Flymode a fost dezactivat.");
    return 1;
    
}

Link to comment
Share on other sites

2 minutes ago, FhenomenN said:

 

Am refacut comanda Fly, deoarece ma incurcasem, si nu mai stiam cum s-o o fak :D

CMD:stopfly(playerid)
{
    StopFly(playerid);
    SetPlayerHealth(playerid, 100);
    SendClientMessage(playerid, COLOR_RED, "[ADMIN]:Flymodeul a fost dezactivat.");
    return 1;
}

Link to comment
Share on other sites

new flymode[MAX_PLAYERS];

la /fly pui flymode[playerid] = 1;

la /stopfly pui 0

te duci la OnPlayerKeyStateChange si cauti if (newkeys & KEY_SECONDARY_ATTACK)

 

pui

 

               if(flymode[playerid] == 1)
               {
                    flymode[playerid] = 0;
                    SendClientMessage(playerid, COLOR_DARKPINK, "Fly mode off.");
                    StopFly(playerid);
                    SetPlayerHealthEx(playerid, 100);
               }

Link to comment
Share on other sites

  • 3 weeks later...

Salutare, daca doresti un videoclip uite-te aici : 

 

 

Pentru inceput faci o variabila cum ar fi:

UsedFly[MAX_PLAYERS];

 

Pentru a face comanda /fly iti trebuie include-ul care il gasesti pe internet. Daca stii sa modifici in el si sa scoti "InitFly(playerid)" ar fii bine deoarece eu nu l-am folosit in comanda de mai jos, mi se pare nefolositor.

Incepi si faci comanda.

CMD:fly(playerid, params[]) {
    if(UsedFly[playerid] == 0)
    {
        StartFly(playerid);
        SetPlayerHealth(playerid, 999999);
        SetPlayerArmour(playerid, 999999);
        SendClientMessage(playerid, COLOR_RED, "[ADMIN]: Flymode a fost activat.");
    }
    if(UsedFly[playerid] == 1)
    {
        StopFly(playerid);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 0);
        SendClientMessage(playerid, COLOR_RED, "[Admin] Flymode a fost dezactivat.");
    }
    return 1;
}

Mergi la OnPlayerKeyStateChange si incepi sa faci verificarea daca apasa pe tasta dorita.

Pentru a vedea tastele uite-te pe acest site : http://wiki.sa-mp.com/wiki/Keys

   if (newkeys & KEY_SECONDARY_ATTACK) {
        if(UsedFly[playerid] == 1) {
            StopFly(playerid);
            UsedFly[playerid] = 0;
            SetPlayerHealth(playerid, 100);
            return 1;
           }
   }

Pentru a nu se face buguri te duci la OnPlayerSpawn si faci verificarea daca are fly on, sa il dezactiveze : 
    if(UsedFly[playerid] == 1) {
        StopFly(playerid);
        UsedFly[playerid] = 0;
        SetPlayerHealth(playerid, 100);
    }

Aceasta merge si la OnPlayerDeath in loc de OnPlayerSpawn.

 

Sper ca ti-am fost de folos.

Link to comment
Share on other sites

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.