Korisne skripte i kodovi

Započeo matejdz, Maj 05, 2009, 12:15:21 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

matejdz

Evo za pocetak cu ja staviti nekoliko naredbi... Jer te teme nema, a glupo mi je naredbe stavljati pod [FS] ili nesto...

Nadam se da nema ljutnje...

Neki serveri nemaju ovu stvar, a to je dobro, zaista :)

if(strcmp(cmd, "/unprison",true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 2)
{
SendClientMessage(playerid, COLOR_GREY, "   Niste autorizovani za koristenje ove naredbe !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "KORISTITE: /unprison [IgracevID/DioImena]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Izbavili ste %s iz AREE 51.", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "* Izbavio vas je iz Admin %s.", sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
GameTextForPlayer(giveplayerid, "Izbavljeni ste, budite bolji gradanin.", 5000, 3);
PlayerInfo[giveplayerid][pJailed] = 0;
PlayerInfo[giveplayerid][pJailTime] = 0;
SetPlayerPos(giveplayerid, 88.5818,1924.8967,17.459);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "   Igrac je Offline !");
return 1;
}
    }
    return 1;
}


Takoder i ovo :)

if(strcmp(cmd, "/unjail", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "KORISTITE: /unjail [IgracevID/DioImena]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Izbavili ste [ID]");
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "* Izbavio vas je Admin %s", sendername);
SendClientMessage(playa, COLOR_LIGHTRED, string);
PlayerInfo[playa][pJailTime] = 0;
GameTextForPlayer(giveplayerid, "Izbavljeni ste, budite bolji gradanin.", 5000, 3);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   Niste autorizirani za koristenje ove naredbe !");
}
}
return 1;
}


Bezvezna naredba, ali isto tako korisna, ako je neki Race ili tako nesto :)

if(strcmp(cmd, "/givenos", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
AddVehicleComponent(vehicleid, 1010);
SendClientMessage(playerid,COLOR_YELLOW,"Dodali ste NOS u vozilo.");
    }
else
{
SendClientMessage(playerid,COLOR_GREY, "Niste Admin !");
    return 1;
}
}
}


Ukoliko vlada kriza, nema bolnicara na serveru

if(strcmp(cmd, "/healall", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
        format(string, sizeof(string), "Admin %s je izlijecio sve igrace na serveru.", sendername);
    SendClientMessageToAll(COLOR_RED, string);
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
SetPlayerHealth(i, 100);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Niste autorizirani za koristenje ove naredbe !");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Niste logirani !");
}
return 1;
}


I jos nesto

if(strcmp(cmd, "/freezeall", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Admin %s je zaledio sve igrace na serveru.", sendername);
SendClientMessageToAll(COLOR_RED, string);
for(new i = 0; i <= 200; i++)
{
if(IsPlayerConnected(i))
{
TogglePlayerControllable(i, false);
}
}
}
return 1;
}


Opet

if(strcmp(cmd, "/unfreezeall", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Admin %s je odledio sve igrace na serveru.", sendername);
SendClientMessageToAll(COLOR_RED, string);
for(new i = 0; i <= 200; i++)
{
if(IsPlayerConnected(i))
{
TogglePlayerControllable(i, true);
}
}
}
return 1;
}


Stavit cu ja jos toga, samo sad je ovako, dok ne vidim neke stvari :)
Poslednja Izmena: Maj 05, 2009, 19:04:59 POSLE PODNE od admin

Super, samo naglasi da je ovo za gf jer mi se cini da je za gf i za pen se moze iskoristiti...

matejdz

Da za GF GameMode je...

Biti ce toga jos, molim da se i drugi aktiviraju, mozda netko ima nesto korisno ;)

funky

evo malo za penls tu sam jaci nego u gfu xD...ovo inace nemaju default penls modovi tak da korisno je  ;)

if(strcmp(cmd, "/asellbizz", true) == 0)
{
GetPlayerName(playerid, playername, sizeof(playername));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "Koristi: /asellbizz [bizz(0-12) ili sbizz id(100-113)]");
return 1;
}
new bizz = strval(tmp);
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1337)
{
    if(bizz >= 0 && bizz <= 12)
    {
BizzInfo[bizz][bHel] = 0;
BizzInfo[bizz][bArm] = 0;
BizzInfo[bizz][bLock] = 1;
BizzInfo[bizz][bOwned] = 0;
strmid(BizzInfo[bizz][bOwner], "Drzava", 0, strlen("Grad"), 255);
format(string, sizeof(string), "~w~Prodao si ovu nekretninu", BizzInfo[bizz][bValue]);
}
else if(bizz >= 100 && bizz <= 113)
{
    SBizzInfo[bizz][sbHel] = 0;
SBizzInfo[bizz][sbArm] = 0;
SBizzInfo[bizz][sbLock] = 1;
SBizzInfo[bizz][sbOwned] = 0;
strmid(SBizzInfo[bizz][sbOwner], "Drzava", 0, strlen("Grad"), 255);
format(string, sizeof(string), "~w~Prodao si ovu nekretninu", SBizzInfo[bizz][sbValue]);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, string, 10000, 3);
OnPropUpdate();
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Nisi ovlasten za to.");
}
return 1;
}


i ovo je potraznja velika sto se tice dm servera hehe...barem sam tak informiran..obicni je brojac ali malo ljudi radi pen tak da korisno je na neki nacin  ;)


kod "public OnPlayerCommandText"

//----------------------------------[ brojac ]-----------------------------------------------------
{
   if(strcmp(cmdtext,"/broj",true) == 0)
   {
   new pName[30];
   if (a == false)
    if(PlayerInfo[playerid][pAdmin] >= 2)
   {
   a = true;
   GetPlayerName(playerid, pName, 30);
   format(string, 256, "*** %s je pokrenuo odbrojavanje.", pName);
   SendClientMessageToAll(COLOR_LIGHTBLUE, string);
   for(new i; i < MAX_PLAYERS; i++)
   {
   GameTextForPlayer(i, "~n~~n~~n~~b~[~y~ 3 ~b~]",1000,3);
   GetPlayerPos(i,X,Y,Z);
   }
   SetTimer("count2",1000,0);
   SetTimer("count1",2000,0);
   SetTimer("countgo",3000,0);
   SetTimer("stop",6000,0);
}
   else SendClientMessage(playerid, 0xFF9900AA, "Odbrojavanje je vec zapoceto!");
   return 1;
   }
}



negdje u mode gdje zelite  ;)


public count2()
{
   for(new i; i < MAX_PLAYERS; i++) {
   GameTextForPlayer(i,"~n~~n~~n~~n~~b~[~y~ 2 ~b~]",1000,3);
   GetPlayerPos(i,X,Y,Z);
   }
}

public count1()
{
   for(new i; i < MAX_PLAYERS; i++) {
   GameTextForPlayer(i,"~n~~n~~n~~n~~n~~b~[~y~ 1 ~b~]",1000,3);
   GetPlayerPos(i,X,Y,Z);
   }
}

public countgo()
{
   for(new i; i < MAX_PLAYERS; i++) {
   GetPlayerPos(i,X,Y,Z);
   GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~y~-~b~]~g~-~g~Start!~g~-~b~]~y~-",1000,3);
   PlayerPlaySound(i,1057,X,Y,Z);
   }
}

public stop()
{
   a = false;
}


;)

Admin Lock


PAWN Code:

new aVehicle; //Above Main


PAWN Code:

//gamemodeinit
aVehicle = AddStaticVehicle(598,2256.0903,2477.0115,10.5668,178.5022,0,1); //gamemodeinit


PAWN Code:

public AdminLock(playerid) //Anywhere in script
{
   if(IsPlayerConnected(playerid))
   {
      if(IsPlayerAdmin(playerid))
      {
         SetVehicleParamsForPlayer(aVehicle, playerid,0,0);
      }
      else
      {
         SetVehicleParamsForPlayer(aVehicle, playerid,0,1);
      }
   }
}


PAWN Code:

public OnPlayerSpawn(playerid)
{
      AdminLock(playerid);
      return 1;
}



PAWN Code:

AddStaticVehicleEx(598,2256.0903,2477.0115,10.5668,178.5022,0,1,never);

Kod za Hotel (Spavanje)

PAWN Code:

enum pInfo
{
Sleeping,
Awake,
Tired
}
new Info[MAX_PLAYERS][pInfo];


PAWN Code:

SetTimer("Motels",5000,1);
SetTimer("SleepTime",300000,1);


PAWN Code:

public SleepTime()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
    SendClientMessage(i,COLOR_GREY,"* You are starting to feel sleep *");
SendClientMessage(i,COLOR_GREY,"* Go to the nearest /hotel and get a rest *");
Info[i] [Tired] = 1;
Info[i] [Awake] = 0;
Info[i] [Sleeping] = 0;
}
}


PAWN Code:

      
public Motels()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
    if(IsPlayerInCube(i,2236,-1076,1040,2245,-1066,1100))
    {
        if(Info[i][Tired] == 1)
        {
                        GameTextForPlayer(i,"~w~Please wait while your energy is ~b~restored",3000,3);
Info[i] [Tired] = 0;
Info[i] [Sleeping] = 1;
Info[i] [Awake] = 0;
TogglePlayerControllable(i,0);
}
if(Info[i] [Awake] == 1)
{
          GameTextForPlayer(i,"~w~You ~g~don't ~w~need to rest",2000,3);
        }
        if(Info[i] [Sleeping] == 1)
        {
                        Info[i] [Awake] = 1;
Info[i] [Tired] = 0;
Info[i] [Sleeping] = 0;
GameTextForPlayer(i,"~w~Rise and Shine",2000,3);
TogglePlayerControllable(i,1);
}
    }
    if(IsPlayerInCube(i,2202,-1070,1000,2211,-1078,1100))
    {
        if(Info[i][Tired] == 1)
        {
                        GameTextForPlayer(i,"~w~Please wait while your energy is ~b~restored",3000,3);
Info[i] [Tired] = 0;
Info[i] [Sleeping] = 1;
Info[i] [Awake] = 0;
TogglePlayerControllable(i,0);
}
if(Info[i] [Awake] == 1)
{
            GameTextForPlayer(i,"~w~You ~g~don't ~w~need to rest",2000,3);
        }
        if(Info[i] [Sleeping] == 1)
        {
                        Info[i] [Awake] = 1;
Info[i] [Tired] = 0;
Info[i] [Sleeping] = 0;
GameTextForPlayer(i,"~w~Rise and Shine",2000,3);
TogglePlayerControllable(i,1);
}
    }
}
    return 1;
}

Red Alert!
Type: Admin Command.
Description: Kick-a sve igrace sa servera u slucaju opasnosti se moze koristiti itd.
Global Variable (Top Of Your Script):
PAWN Code:

new RedAlertTimer;

Function
PAWN Code:

public KickAll()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
Kick(i);
}
}
}


The Command: (Under The OnPlayerCommandText Callback)
PAWN Code:

if (strcmp(cmdtext, "/redalert", true)==0)
{
    if(IsPlayerAdmin(playerid))
    {
        new string[256];
        new aname[256];
        GetPlayerName(playerid,aname,sizeof(aname));
        GameTextForAll("~r~Red Alert",7000,4);
        format(string,sizeof(string), "Admin: %s has called Red Alert",aname);
        SendClientMessageToAll(0xAA3333AA,string);
        SendClientMessageToAll(0xAA3333AA,"You will all be kicked in ten seconds.");
        RedAlertTimer = SetTimer("KickAll",10000,0);
        SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Successful. To Abort Type /abort");
        printf("%s has initialized the red alert countdown.",aname);
        return 1;
    }
    else
    {
        return 0;
    }
    return 1;
}
if (strcmp(cmdtext, "/abort", true)==0)
{
    if(IsPlayerAdmin(playerid))
    {
        new string[256];
        new aname[256];
        GetPlayerName(playerid,aname,sizeof(aname));
        GameTextForAll("~y~Red Alert Aborted",7000,4);
        format(string,sizeof(string), "Admin: %s has canceled the Red Alert",aname);
        SendClientMessageToAll(0x33AA33AA,string);
        KillTimer(RedAlertTimer);
        SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Abort Successful.");
printf("%s has cancelled the red alert countdown.",aname);
        return 1;
}
else
{
    return 0;
}
                return 1;
}

matejdz

Ivane nisi preveo xD...

Funky_G ovo za odbrojavanje je super i za RPG server, kad su neki Eventi...

Ja sam napravio nesto slicno jos prije, kao [FS], ali neznam gdje sam izgubio ;)


Admin On Duty i Admin Off Duty..  ;)

if(strcmp(cmd, "/adminonduty", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
SetPlayerColor(playerid, TEAM_BALLAS_COLOR);
SetPlayerHealth(playerid,200.0);
SetPlayerArmour(playerid,100.0);
SendClientMessage(playerid, TEAM_BALLAS_COLOR, "Sad si On Duty !");
}
return 1;
}

if(strcmp(cmd, "/adminoffduty", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
SetPlayerColor(playerid, COLOR_WHITE);
SetPlayerHealth(playerid,100.0);
SetPlayerArmour(playerid,0.0);
SendClientMessage(playerid, COLOR_WHITE, "Nisi vise On Duty !");
}
return 1;
}

matejdz

Probaj napraviti da kada upise /adminonduty da svima posalje poruku da je On Duty, da znaju kome se trebaju obratiti...

U svakom slucaju, ovo je korisno, bravo Filipe...

Tri posta su obrisana, jer se ovdje radi o korisnim skriptama i kodovima, ne o vasim svadama i prepiranjima...

ScorpioN

Nemam SA-MP,pa mi jedino skriptanje preostaje :P
Evo ovo je moj napamet napravljen admin on duty,znam da ima par postova iznad mene al ovaj je s jednom komandom (/admin) i jos posalje poruku svima ako si na duznosti,neznam hoce vam radit,promijenite i ovu boju ADMIN po zelji...ovo mogu svi igraci koristit,e to morate stavit,neznam kako vi imate PlayerInfo[playerid][aAdmin] ili sta vec,a takoder mozete sa IsPlayerAdmin(playerid); ali to je samo za RCON pa je malo glupo


#define ADMIN 0x333333FF // boju sam bezveze napamet napisao


new aod[MAX_PLAYERS]; // aod - admin on duty


public OnPlayerConnect(playerid)
{
        aod[playerid] = 0;
        return 1;
}


public OnPlayerCommandText(playerid,cmdtext[])
{
        new pIme[MAX_PLAYER_NAME];
        new iString[128];

        if(strcmp(cmd,"/admin",true)==0)
        {
                if(aod[playerid] == 0)
                {
                        SetPlayerColor(playerid,ADMIN);
                        SetPlayerHealth(playerid,150.0);
                        SetPlayerArmour(playerid,100.0);
                        GetPlayerName(playerid,pIme,sizeof(iString));
                        format(iString,sizeof(iString),"Admin %s je od sada na dužnosti!");
                        SendClientMessageToAll(ADMIN,iString);
                        }
                 else if(aod[playerid] == 1)
                 {
                        SetPlayerArmour(playerid,0);
                        SetPlayerHealth(playerid,50);
                      }
            return 1;
        }
                       

               

matejdz


ScorpioN

ups..zaboravio sam
stavi dolje ispod

if(aod[playerid]==0)
{
       aod[playerid]=1;
}

a ispod

if(aod[playerid]==1)
{
       aod[playerid]=0;
}


i radit ce ti sve na jednu komandu (/admin)
Poslednja Izmena: Maj 22, 2009, 10:04:33 PRE PODNE od [CH]matejdz

Evo jedna i od mene


    if (!strcmp(cmd, "/pu", true))
   {
      tmp = strtok(cmdtext, idx);
      if (!strlen(tmp))
         return SendClientMessage(playerid, COLOR_YELLOW, "Koristenje: /pu [playerid] [seatid]");
      new person = strval(tmp);
      tmp = strtok(cmdtext, idx);
      if (!strlen(tmp))
      return SendClientMessage(playerid, COLOR_YELLOW, "Koristenje: /pu [playerid] [seatid]");
      new seat = strval(tmp);
      new Float:pos[6];
      if (gTeam[playerid] == TEAM_BLUE )
       {
         if(IsPlayerConnected(person))
         {
            if(GetDistanceBetweenPlayers(playerid,person) < 5)
            {
                    new player[MAX_PLAYER_NAME];
                    new personn[MAX_PLAYER_NAME];
                GetPlayerName(playerid, player, sizeof(player));
                GetPlayerName(person, personn, sizeof(personn));
               GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
               GetPlayerPos(person, pos[3], pos[4], pos[5]);
               if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
               floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
               floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
               PutPlayerInVehicle(person, GetPlayerVehicleID(playerid), seat);
                return 1;
            }//distance
            else
            {
               SendClientMessage(playerid, COLOR_GREY, "Predaleko ste od igraca.");
                return 1;
            }
         }//not connected
         else
         {
              SendClientMessage(playerid, COLOR_GREY, "Igrac je Offline.");
             return 1;
         }
      } else return SendClientMessage(playerid, COLOR_GREY, "Niste Policajac!!!");
   }

jos jedna




if(strcmp(cmd, "/agl", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(playerid))
{
format(string, sizeof(string), "Admin je dao License svim igracima na serveru.", sendername);
SendClientMessageToAll(COLOR_LIGHTRED, string);
            for(new i = 0; i < MAX_PLAYERS; i ++)
{
    if(IsPlayerConnected(playerid))
    {
PlayerInfo[playerid][pCarLic] = 1;
                PlayerInfo[playerid][pFlyLic] = 1;
                PlayerInfo[playerid][pBoatLic] = 1;
                PlayerInfo[playerid][pFishLic] = 1;
                PlayerInfo[playerid][pGunLic] = 1;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Niste autorizirani za koristenje ove naredbe!");
}
}
return 1;
}