Korisne skripte i kodovi

Započeo Correlli, Mart 10, 2010, 20:26:26 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 4 gostiju pregledaju ovu temu.


vlado_plavsic

Citat: Edis Macic poslato Jun 15, 2012, 12:56:49 POSLE PODNE
Treba mi JunkBuster preveden jel Neko Ima?!

Citat: Brian Brendell poslato Jun 15, 2012, 13:02:19 POSLE PODNE
i meni treba preveden JunkBuster da li neko ima? :)

Cek jeste vi retardiradi? Ne kontam,jel to radite namerno ili sta?

Evo jedne funkcije koja ce mozda nekima koristit. Funkcija provjerava jel sjedalo u odreÄ'enom autu zauzeto:

stock ZauzetoSjedalo(vozilo, sjedalo)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == vozilo && GetPlayerVehicleSeat(i) == sjedalo) return 1;
}
return 0;
}



a koristi se npr:


stock PutPlayerInFreeSeat(CarID, PlayerID)
{
for(sjedalo = 0; sjedalo < 4; sjedalo++)
{
if(ZauzetoSjedalo(CarID, sjedalo) == 0)
  {
    PutPlayerInVehicle(PlayerID, CarID, sjedalo);
    break;
            }
}
return 1;
}


Nadam se da ce vam raditi (nazalost nemam kako isprobati)..
Vikend je policija nas hvata,
vikend je ode cijela plata,
oko nas stvari ukradene,
sve smo dali na planove i sheme..
||||:=:=:=:=:=:=::=:=:=:=:=:=:=:THE IVEX:=:=:=:=:=:=:=:=:=::=:=:=:=:=:=::=:|||| 


PS: Ne saljite mi nikakve pm jer neodgovaram na njih! Ako trebate nes pitajte ove pr0 skriptere pa neka vam kazu!Hvala !

vlado_plavsic

Evo jedna funkcija da vam skrati posao:

#define CreateListDialog(%1,%2,%3,%4); ShowPlayerDialog(%1, %2, DIALOG_STYLE_LIST, %3, %4, "Izaberi", "Odustani");

Primer:

CreateListDialog(playerid,3," Naslov "," Dugme1\nDugme2 ");

Isto tako mozete i za ostale dialoge da napravite,samo zamenite DIALOG_SYLE i prilagodite parametre :)

//na vrhu
#include <zcmd> //to morate skinuti
#include <sscanf> //ovo takodje morate skinuti
#include <double-o-Files> //i ovo isto morate skinuti

new ADM[MAX_PLAYERS];
new upoz[MAX_PLAYERS];

//komanda
CMD:dwarn(playerid,cmdtext[])
{
   if(!ADM[playerid]) return SendClientMessage(playerid,COLOR_GREEN,"Nisi ADM"); //adm promijenite po zelji
   new id,powod[64];
   if(sscanf(cmdtext,"ADM",id,powod)) return SendClientMessage(playerid,COLOR_GREEN,"Koristi: /dwarn [ID] [Razlog]");
   if(id < 0 || id > GetMaxPlayers()) return SendClientMessage(playerid,-1,"Igrac nije konektovan!");

   Warn[id]++;
   new x[124];
   format(x,sizeof(x),"Igrac %s (id: %d) je dobio upozorenje (%d/2) od strane ADM. Razlog:%s",PlayerName(id),id,upoz[id],powod);
   SendClientMessageToAll(COLOR_ADMIN,x);

   if(Warn[id] == 2)


   {
      new string[124];
      format(string,sizeof(string),"Igrac %s (id: %d) je uklonje sa servera! Razlog:%s",PlayerName(id),id);
      SendClientMessageToAll(COLOR_ADMIN,string);
      print(string);
      Kick(id);
      return 1;


   }
   return 1;
}
CMD:dunwarn(playerid,params[])
{
   if(!ADM[playerid]) return SendClientMessage(playerid,COLOR_GREEN,"Nisi ADM");
   new id = strval(params);
   if(id < 0 || id > GetMaxPlayers()) return SendClientMessage(playerid,COLOR_YELLOW,"Koristi: /dunwarn [ID]");
   Warn[id] --;
   new string[256];
   format(string,sizeof(string),"Discret Admin skida upozorenja (%d/2) igracu %s (id: %d)",Warn[id],PlayerName(playerid),playerid);
   SendClientMessageToAll(COLOR_ADMIN,string);
   return 1;
}

Samo ime kaze sta rade:  8)

////////////////////////////////////////////////////////////////////////////////
stock GivePlayerHealth(playerid,Float:Health)
{
new Float:health; GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health+Health);
}
////////////////////////////////////////////////////////////////////////////////
stock GivePlayerArmour(playerid,Float:Armour)
{
new Float:armour; GetPlayerHealth(playerid,armour);
SetPlayerArmour(playerid,armour+Armour);
}
////////////////////////////////////////////////////////////////////////////////
Izvinjavam se na svim glupostima i ako sam nekome napisao nesto lose, neko drugi je koristio moj profil!
__________________________________________
https://bk.gta.world - GTA World Balkan - RAGEMP

@KopriVa malo bolji nacin:

stock GivePlayerHealth(playerid, Float:Health)
{
new Float:currentHealth;
        GetPlayerHealth(playerid, currentHealth);
SetPlayerHealth(playerid, floatadd(currentHealth, Health));
}

stock GivePlayerArmour(playerid, Float:Armour)
{
new Float:currentArmour;
GetPlayerHealth(playerid, currentArmour);
SetPlayerArmour(playerid, floatadd(currentArmour, Armour));
}


- Mali speed test


Rezultati:
   Tvoja: 6 ms
   Moja: 5 ms



Rezultati:
   Tvoja: 5 ms
   Moja: 5 ms



Rezultati:
   Tvoja: 6 ms
   Moja: 5 ms


Test skripta: http://pastebin.com/LFpvYcj4
Poslednja Izmena: Jul 27, 2012, 09:08:10 PRE PODNE od Snooker

Evo GivePlayerHealth,GivePlayerArmour i GivePlayerScore funkcije  ;)

stock GivePlayerHealth(playerid,Float:Health)
{
new Float:health; GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health+Health);
}


stock GivePlayerArmour(playerid,Float:Armour)
{
new Float:armour; GetPlayerArmour(playerid,armour);
SetPlayerArmour(playerid,armour+Armour);
}


stock GivePlayerScore(playerid,Float:Score)
{
    SetPlayerScore(playerid,GetPlayerScore(playerid)+Score);
}


EDIT: Ovo nije moje nasao sam na Sluzbenom SA:MP forumu..
Poslednja Izmena: Avgust 02, 2012, 23:49:06 POSLE PODNE od Dm0nSt€R



Citat: ¤¤R0x0r¤¤ poslato Avgust 02, 2012, 14:44:51 POSLE PODNE
Evo GivePlayerHealth,GivePlayerArmour i GivePlayerScore funkcije  ;)

stock GivePlayerHealth(playerid,Float:Health)
{
new Float:health; GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health+Health);
}


stock GivePlayerArmour(playerid,Float:Armour)
{
new Float:armour; GetPlayerArmour(playerid,armour);
SetPlayerArmour(playerid,armour+Armour);
}


stock GivePlayerScore(playerid,Float:Score)
{
    SetPlayerScore(playerid,GetPlayerScore(playerid)+Score);
}



http://forum.sa-mp.com/showthread.php?t=151210

bič pliz

Citat: [BURPG] TiXoR_ poslato Avgust 02, 2012, 17:03:09 POSLE PODNE
Citat: ¤¤R0x0r¤¤ poslato Avgust 02, 2012, 14:44:51 POSLE PODNE
Evo GivePlayerHealth,GivePlayerArmour i GivePlayerScore funkcije  ;)

stock GivePlayerHealth(playerid,Float:Health)
{
new Float:health; GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health+Health);
}


stock GivePlayerArmour(playerid,Float:Armour)
{
new Float:armour; GetPlayerArmour(playerid,armour);
SetPlayerArmour(playerid,armour+Armour);
}


stock GivePlayerScore(playerid,Float:Score)
{
    SetPlayerScore(playerid,GetPlayerScore(playerid)+Score);
}



http://forum.sa-mp.com/showthread.php?t=151210

bič pliz

Jesam napisao da je moje?



@Dm0nStâ,¬R, ali nigdje nisi naveo da nije tvoje. ;)

Last nick: Paradox


Citat: Snooker(stari profil) poslato Jul 27, 2012, 08:48:34 PRE PODNE
@KopriVa malo bolji nacin:

stock GivePlayerHealth(playerid, Float:Health)
{
new Float:currentHealth;
        GetPlayerHealth(playerid, currentHealth);
SetPlayerHealth(playerid, floatadd(currentHealth, Health));
}

stock GivePlayerArmour(playerid, Float:Armour)
{
new Float:currentArmour;
GetPlayerHealth(playerid, currentArmour);
SetPlayerArmour(playerid, floatadd(currentArmour, Armour));
}


- Mali speed test


Rezultati:
   Tvoja: 6 ms
   Moja: 5 ms



Rezultati:
   Tvoja: 5 ms
   Moja: 5 ms



Rezultati:
   Tvoja: 6 ms
   Moja: 5 ms


Test skripta: http://pastebin.com/LFpvYcj4

Hvala na ispravljanju,radio sam neki war sistem za nekog lika pa sam ovo na brzinu odradio :D

SetPlayerSkinEx


stock SetPlayerSkinEx(skinid, ...)
{
    new nArg = numargs();
    for(new i = 1; i < nArg; i++)
    {
        new playerid = getarg(i);
        if(IsPlayerConnected(playerid)) SetPlayerSkin(playerid, skinid);
    }
}


Upotreba (primer):
SetPlayerSkinEx(115, 3, 2, 1, 10, 9, 6); // 3, 2, 1, 10, 9, 6 su ID-ovi igraca, a 115 je skinid

Moje misljenje:
Nije najbolja funkcija, ali moze da posluzi u dosta slucajeva.

Mislim da ima ljudi koji ovo traze pa eto da objavim
Trebate sistem da vam ucitava admine i online i offline?
Neznate bez MySQL?
Evo samo ovo uradite:

idite u scriptfiles i napravite file:
admini
ovo stavite ko /makeadmin(zamijenjite vasu cmd sa mojom):
if(strcmp(cmd, "/makeadmin", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /makeadmin [ID Igraca/Dio Imena] [level(1-3)]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(PlayerInfo[playerid][pAdmin] >= 1340)
{
    if(IsPlayerConnected(para1))
    {
        if(para1 != INVALID_PLAYER_ID)
        {
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("AdmCmd: Admin je %s-u dao odredjeni admin level.", sendername, giveplayer, level);
format(string, sizeof(string), "  Admin vam je dao/oduzeo admin level ", level, sendername);
SendClientMessage(para1, COLOR_WHITE, string);
format(string, sizeof(string), "   Dali/oduzeli ste %s-u admin level .", giveplayer,level);
SendClientMessage(playerid, COLOR_WHITE, string);
dfasfascc(para1,level);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}[ERROR] {FFFFFF}Niste ovlasteni da koristite tu komandu!");
}
}
return 1;
}



A komandu /admini zamijenite sa :
if (strcmp(cmd, "/admini", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new klok[1300];
new mic;
for(new i = 0; i < 100; i++)
{
new FileName[128];
format(FileName, sizeof(FileName), "admini/Admin_%d.ini", i);
if(fexist(FileName) )
{
mic=1;
Admin[i][adIme]= dini_Get(FileName, "Ime" );
Admin[i][adRank]= dini_Int(FileName, "Rank" );
new blabla[300];
new blabla2[300];
if(IsPlayerConnected(GetPlayerIDS(Admin[i][adIme])))
{
format(blabla, sizeof(blabla),"{80FF00}[ONLINE] %s",Admin[i][adIme]);
strcat(klok, blabla);
strcat(klok, "{ffffff} Rank:");
format(blabla2, sizeof(blabla2), "{FFFF00}%d",Admin[i][adRank]);
strcat(klok,blabla2);
strcat(klok, "\n");
}
else if(!IsPlayerConnected(GetPlayerIDS(Admin[i][adIme])))
{
format(blabla, sizeof(blabla) ,"{FFFF00}[OFFLINE]%s",Admin[i][adIme]);
strcat(klok, blabla);
strcat(klok, "{9c9c9c} Rank:");
format(blabla2, sizeof(blabla2), "{80FF00}%d",Admin[i][adRank]);
strcat(klok,blabla2);
strcat(klok, "\n");
}
}
}
if(mic==0)
{
SendClientMessage(playerid,COLOR_GREEN, "Trenutno nema admina online !");
}
else
{ShowPlayerDialog(playerid,36,DIALOG_STYLE_MSGBOX,"Lista admina",klok,"OK","");
}
}

Dodajte i ovaj stock:
stock dfasfascc(giver,level)
{
adminsteras(giver);
if(level != 0)
{
new giveplayer[MAX_PLAYER_NAME];
GetPlayerName(giver, giveplayer, sizeof(giveplayer));
new lolcina = 1;
for(new mica = 1; mica < 100; mica++)
{
new stringers[600];
format(stringers, sizeof(stringers), "admini/Admin_%d.ini", mica);
if(lolcina == 0){return 1;}
if(!fexist(stringers))
{
lolcina = 0;
strmid(Admin[mica][adIme],giveplayer, 0, strlen(giveplayer), 255);
Admin[mica][adRank]=level;
dini_Create(stringers);
SaveAdmine();
}
}
}
return 1;
}

Nadam se da sam nekom pomogo :)
Poslednja Izmena: Avgust 12, 2012, 22:54:06 POSLE PODNE od Sany Boy