Korisne komande

Započeo Correlli, Maj 28, 2010, 16:52:57 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 9 gostiju pregledaju ovu temu.

Citat: Zorz poslato Jul 10, 2017, 14:46:56 POSLE PODNE
Evo jedne korisne komande za DM/RP servere.Ova komanda moze posluziti Admnima kako ih ne bi mogli ubiti.
Radjena je uz pomoc ZCMD.Potreban je i sscanf kako bi proverili da li je taj igrac koji koristi komandu admin.
[pawn]#include <zcmd>
#include <sscanf2>[/pawn]
Sada dodajte ovaj new:
[pawn]new God[MAX_PLAYERS] = 0;[/pawn]

Dalje radimo komandu, to ide ovako:
[pawn]CMD:adminhealth(playerid, params[])
{
   if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,CRVENA,"[GRESKA]:Morate biti Admin da bi koristili ovu komandu !");
   else
   {
      if(God[playerid] == 1)
      {
          God[playerid] = 0;
          SendClientMessage(playerid,NARANDZASTA,"[OBAVESTENJE]:Iskljucili ste Admin Health !");
          SetPlayerHealth(playerid,100.0);
      }
      else
      {
           God[playerid] = 1;
          SetPlayerHealth(playerid,1000.0);
           SendClientMessage(playerid,NARANDZASTA,"[OBAVESTENJE]:Ukljucili ste Admin Health !");
      }
   }
   return 1;
}[/pawn]

Sada u svom modu nadjite "public OnPlayerDeath(playerid, killerid, reason)" i tu dodajte sledece:
[pawn]public OnPlayerDeath(playerid, killerid, reason)
{
   if(God[playerid] == 1)
   {
       God[playerid] = 0;
   }
   return 1;
}[/pawn]

Zatim dodajte ili ako imate nadjite OnPlayerUpdate(playerid) i tu upisite:
[pawn]public OnPlayerUpdate(playerid)
{
   if(God[playerid] == 1)
   {
       new Float:health;
       GetPlayerHealth(playerid,health);
      if(health < 1000.0)
      {
          SetPlayerHealth(playerid, 1000.0);
      }
   }
   return 1;
}[/pawn]

E to vam je ta komanda, uz pomoc nje, ako ste Admin ne mogu vas ubiti. :)

Moze ovo veoma jednostavnije ako se ne varam
Samo onplayertakeshoot (tako nesto se zove callback), i samo ako je taj koga puca admin, da ne skida adminu health, samo da mu svaki put kad ga puca stavi mu na 100 lol
heroin rap - Moskri u kuci, od sledece lajne glava ce mi puci

Ne znam, verovatno moze jednostavnije, ali ja znam za ovaj nacin i radi, u medjuvremenu testirao sam ga i pod vodom, nije u pitanju samo ako te pucaju vec bio sta da ti skida helte(skocis sa neke visine, davis se pod vodom, puca te neko itd..) opet ti vraca helte na max.

Citat: TiXoR_ poslato Maj 22, 2011, 17:53:02 POSLE PODNE
Citat: eXtreme poslato Januar 26, 2011, 14:40:40 POSLE PODNE
Komanda:

    CMD:me(playerid, params[])
    {
        if(IsPlayerConnected(playerid))
      {
      new
      MeTxT,
      string[180],
      Ime[MAX_PLAYER_NAME];
      GetPlayerName(playerid, Ime, sizeof(Ime));
      if(sscanf(params, "s", MeTxT)) return SendClientMessage(playerid, 0xFFFFFFFF, "[member=1996][/member] /me <TxT> [member=1996][/member]");
      format(string, sizeof(string), "* %s %s", Ime, MeTxT);
        ProxDetector(30, playerid, string, 0xFFFFFFFF, 0xEFEFEFFF, 0xDFDFDFFF, 0xCFCFCFFF, 0xBFBFBFFF);
        }
        return false;
    }


Napomena: ZCMD i SSCANF :)

ProxDetector:

stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                {
                    SendClientMessage(i, col1, string);
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                {
                    SendClientMessage(i, col2, string);
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                {
                    SendClientMessage(i, col3, string);
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                {
                    SendClientMessage(i, col4, string);
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                {
                    SendClientMessage(i, col5, string);
                }
            }
        }
    }
    return 1;
}   

Ovo ne radi  8)
Stavi ovako:

CMD:me(playerid, params[])
{
new
s[80],
s1[180],
pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(sscanf(params, "s", s)) return SendClientMessage(playerid, 0xFFFFFFFF, "[member=1996][/member] /me <TxT> [member=1996][/member]");
format(s1, sizeof(s1), "* %s %s", pName, s);
ProxDetector(30, playerid, s1, 0xFFFFFFFF, 0xEFEFEFFF, 0xDFDFDFFF, 0xCFCFCFFF, 0xBFBFBFFF);
return true;
}



Credits: Aleksandar
Kako definirati ProxDetector

[pawn]stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                {
                    SendClientMessage(i, col1, string);
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                {
                    SendClientMessage(i, col2, string);
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                {
                    SendClientMessage(i, col3, string);
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                {
                    SendClientMessage(i, col4, string);
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                {
                    SendClientMessage(i, col5, string);
                }
            }
        }
    }
    return 1;
}    [/pawn]

Citat: TiXoR_ poslato Septembar 09, 2017, 14:34:00 POSLE PODNE
[pawn]stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                {
                    SendClientMessage(i, col1, string);
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                {
                    SendClientMessage(i, col2, string);
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                {
                    SendClientMessage(i, col3, string);
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                {
                    SendClientMessage(i, col4, string);
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                {
                    SendClientMessage(i, col5, string);
                }
            }
        }
    }
    return 1;
}    [/pawn]
ima i laksih kodova, ovo niko ni ne koristi vise
heroin rap - Moskri u kuci, od sledece lajne glava ce mi puci

Citat: Łukmember=1996][/member] link=topic=7222.msg758402#msg758402 date=1504992175]
Citat: TiXoR_ poslato Septembar 09, 2017, 14:34:00 POSLE PODNE
[pawn]stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                {
                    SendClientMessage(i, col1, string);
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                {
                    SendClientMessage(i, col2, string);
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                {
                    SendClientMessage(i, col3, string);
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                {
                    SendClientMessage(i, col4, string);
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                {
                    SendClientMessage(i, col5, string);
                }
            }
        }
    }
    return 1;
}    [/pawn]
ima i laksih kodova, ovo niko ni ne koristi vise

samo san mu kopira jer je očito slip jer mu piše već u tom postu kojeg je citira..

Kako da stavim komandu /help to ne znam lol


Citat: Balsa. poslato Septembar 30, 2017, 22:48:36 POSLE PODNE
Kako da stavim komandu /help to ne znam lol

dialog samo napravis, imas tut na forumu.

Citat: z04k poslato Septembar 30, 2017, 22:51:36 POSLE PODNE
Citat: Balsa. poslato Septembar 30, 2017, 22:48:36 POSLE PODNE
Kako da stavim komandu /help to ne znam lol

dialog samo napravis, imas tut na forumu.
Ne nakupljaj postove bezveze, ovo je 4. put da to radis

Kreiraj komandu, definisi dialog, i pod onplayerdialogresponse stavis ako je dialog taj i taj sta ce da se desi, posjeti kampove za pawn skriptanje ;)
heroin rap - Moskri u kuci, od sledece lajne glava ce mi puci

Citat: Łukmember=1996][/member] link=topic=7222.msg763836#msg763836 date=1506876365]
Citat: z04k poslato Septembar 30, 2017, 22:51:36 POSLE PODNE
Citat: Balsa. poslato Septembar 30, 2017, 22:48:36 POSLE PODNE
Kako da stavim komandu /help to ne znam lol

dialog samo napravis, imas tut na forumu.
Ne nakupljaj postove bezveze, ovo je 4. put da to radis

Kreiraj komandu, definisi dialog, i pod onplayerdialogresponse stavis ako je dialog taj i taj sta ce da se desi, posjeti kampove za pawn skriptanje ;)
Okej hvala,uspio sam