Korisne Komande x Funkcije!? (Čitajte ovdje)

Mister Naithan Započeo imnaithan
pre 6 godina
24,346
pregleda
46
postova
XACK
Hustler
pre 5 godina
hook post:990306
{
- Komanda x Funkcija = https://pastebin.com/3BWnMZ5Q
}
Skrilew
Godfather
pre 5 godina
- Vase ime na forumu: V01D
- Komanda x Funkcija :
GetWeekDay(day=0, month=0, year=0)
{
  if (!day)
    getdate(year, month, day);

  new
    weekday_str,
    j,
    e
  ;

  if (month <= 2)
  {
    month += 12;
    --year;
  }

  j = year % 100;
  e = year / 100;

  switch ((day + (month+1)*26/10 + j + j/4 + e/4 - 2*e) % 7)
  {
    case 0: weekday_str = "Subota";
    case 1: weekday_str = "Nedelja";
    case 2: weekday_str = "Ponedeljak";
    case 3: weekday_str = "Utorak";
    case 4: weekday_str = "Sreda";
    case 5: weekday_str = "Cetvrtak";
    case 6: weekday_str = "Petak";
  }

  return weekday_str;
}

//Upotreba :
va_SendClientMessage(playerid, 0x95b4a2FF, "Danas je %s", GetWeekDay());

- Opis:
Na stranom forumu sam nasao funkciju koja vrati dan u nedelji, tako da sam preveo dane i primenio u svoju korist
- Dodatak: OVO NIJE MOJE!
- Credits: Nemam predstavu
- Slike: Ne trebaju
King of the Jungle
Wheel Man
pre 5 godina
- Komanda x Funkcija :
stock RemovePlayerWeapon(playerid, weaponid)
{
    return SetPlayerAmmo(playerid, weaponid, 0);
}

- Opis:
Video sam da mnogi koriste for loop(petlju) koja prolazi kroz svih 13 slotova i get-a pre toga weapon data i onda uporedjuje unutar loop-a ali evo jedna jako jednostavna a brza funkcija 😄
- Dodatak: Nisam testirao jer nema baš šta da se testira... 😄
- Credits: //
CoA|Logan
Street Runner
pre 5 godina
- Komanda x Funkcija:

/*
        2019 - ChatBreaker Include v1.0. written by Logan
        08/2020 - v1.1. - Added support for breaking/passing embedded colors in next chat line/row
*/
stock SendSplitMessage(playerid, color, const final[])
{
    new len = strlen(final);
    if(len >= 100)
    {
new buffer,
colorstring = EOS, colorstart = 0, colorend = 0,
buffer2, spacepos = 0, bool:broken = false;

for(new j = 60; j < len; j++)
{
if(final == '{')
colorstart = j;

if(final == '}')
colorend = j + 1;

if(final == ' ')
spacepos = j;

if(j >= 90 && spacepos >= 60 && (colorstart == 0 || (colorstart != 0 && colorend > colorstart)))
{
broken = true;
if(colorstart != 0 && colorend != 0)
strmid(colorstring, final, colorstart, colorend, sizeof(colorstring));
strmid(buffer, final, 0, spacepos);
format(buffer, sizeof(buffer), "%s...", buffer);
SendClientMessage(playerid, color, buffer);
strmid(buffer2, final, spacepos+1, len);
format(buffer2, sizeof(buffer2), "%s...%s", colorstring, buffer2);
SendClientMessage(playerid, color, buffer2);
return 1;
}
}
if(!broken)
SendClientMessage(playerid, color, final);
}
    else return SendClientMessage(playerid, color, final);
return 1;
}

stock SendSplitMessageToAll(color, const final[])
{
    new len = strlen(final);
    if(len >= 100)
    {
new buffer,
colorstring = EOS, colorstart = 0, colorend = 0,
buffer2, spacepos = 0, bool:broken=false;

for(new j = 60; j < len; j++)
{
if(final == ' ')
spacepos = j;

if(final == '{')
colorstart = j;

if(final == '}')
colorend = j + 1;

if(j >= 90 && spacepos >= 60 && (colorstart == 0 || (colorstart != 0 && colorend > colorstart)))
{
broken = true;
if(colorstart != 0 && colorend != 0)
strmid(colorstring, final, colorstart, colorend, sizeof(colorstring));
strmid(buffer, final, 0, spacepos);
format(buffer, sizeof(buffer), "%s...", buffer);
SendClientMessageToAll(color, buffer);
strmid(buffer2, final, spacepos+1, len);
format(buffer2, sizeof(buffer2), "%s...%s", colorstring, buffer2);
SendClientMessageToAll(color, buffer2);
return 1;
}
}
if(!broken)
SendClientMessageToAll(color, final);
}
    else return SendClientMessageToAll(color, final);
return 1;
}

stock AC_SendClientMessageToAll(color, const message[])
{
SendSplitMessageToAll(color, message);
return 1;
}
#if defined _ALS_SendClientMessageToAll
    #undef SendClientMessageToAll
#else
    #define _ALS_SendClientMessageToAll
#endif
#define SendClientMessageToAll AC_SendClientMessageToAll

stock AC_SendClientMessage(playerid, color, const message[])
{
SendSplitMessage(playerid, color, message);
return 1;
}
#if defined _ALS_SendClientMessage
    #undef SendClientMessage
#else
    #define _ALS_SendClientMessage
#endif
#define SendClientMessage AC_SendClientMessage


- Opis: ChatBreaker v1.1 lomi SCM(ToAll) stringove duže od 100 znakova u 2 reda, nikada usred riječi, nego traži space da bi slomi od 60tog do 90tog znaka. Ukoliko ih ne nađe, ne razlama se string(što se gotovo nikad ne dešava, pošto su tako duge riječi VRLO rijetke). Prenosi i embedded({ FFFFFF }) boje u sljedeći red ukoliko postoje unutar stringa.
King of the Jungle
Wheel Man
pre 5 godina
CoA|Logan wrote on August 31, 2020, 4:54 pm:
- Komanda x Funkcija:

/*
        2019 - ChatBreaker Include v1.0. written by Logan
        08/2020 - v1.1. - Added support for breaking/passing embedded colors in next chat line/row
*/
stock SendSplitMessage(playerid, color, const final[])
{
    new len = strlen(final);
    if(len >= 100)
    {
new buffer,
colorstring = EOS, colorstart = 0, colorend = 0,
buffer2, spacepos = 0, bool:broken = false;

for(new j = 60; j < len; j++)
{
if(final == '{')
colorstart = j;

if(final == '}')
colorend = j + 1;

if(final == ' ')
spacepos = j;

if(j >= 90 && spacepos >= 60 && (colorstart == 0 || (colorstart != 0 && colorend > colorstart)))
{
broken = true;
if(colorstart != 0 && colorend != 0)
strmid(colorstring, final, colorstart, colorend, sizeof(colorstring));
strmid(buffer, final, 0, spacepos);
format(buffer, sizeof(buffer), "%s...", buffer);
SendClientMessage(playerid, color, buffer);
strmid(buffer2, final, spacepos+1, len);
format(buffer2, sizeof(buffer2), "%s...%s", colorstring, buffer2);
SendClientMessage(playerid, color, buffer2);
return 1;
}
}
if(!broken)
SendClientMessage(playerid, color, final);
}
    else return SendClientMessage(playerid, color, final);
return 1;
}

stock SendSplitMessageToAll(color, const final[])
{
    new len = strlen(final);
    if(len >= 100)
    {
new buffer,
colorstring = EOS, colorstart = 0, colorend = 0,
buffer2, spacepos = 0, bool:broken=false;

for(new j = 60; j < len; j++)
{
if(final == ' ')
spacepos = j;

if(final == '{')
colorstart = j;

if(final == '}')
colorend = j + 1;

if(j >= 90 && spacepos >= 60 && (colorstart == 0 || (colorstart != 0 && colorend > colorstart)))
{
broken = true;
if(colorstart != 0 && colorend != 0)
strmid(colorstring, final, colorstart, colorend, sizeof(colorstring));
strmid(buffer, final, 0, spacepos);
format(buffer, sizeof(buffer), "%s...", buffer);
SendClientMessageToAll(color, buffer);
strmid(buffer2, final, spacepos+1, len);
format(buffer2, sizeof(buffer2), "%s...%s", colorstring, buffer2);
SendClientMessageToAll(color, buffer2);
return 1;
}
}
if(!broken)
SendClientMessageToAll(color, final);
}
    else return SendClientMessageToAll(color, final);
return 1;
}

stock AC_SendClientMessageToAll(color, const message[])
{
SendSplitMessageToAll(color, message);
return 1;
}
#if defined _ALS_SendClientMessageToAll
    #undef SendClientMessageToAll
#else
    #define _ALS_SendClientMessageToAll
#endif
#define SendClientMessageToAll AC_SendClientMessageToAll

stock AC_SendClientMessage(playerid, color, const message[])
{
SendSplitMessage(playerid, color, message);
return 1;
}
#if defined _ALS_SendClientMessage
    #undef SendClientMessage
#else
    #define _ALS_SendClientMessage
#endif
#define SendClientMessage AC_SendClientMessage


- Opis: ChatBreaker v1.1 lomi SCM(ToAll) stringove duže od 100 znakova u 2 reda, nikada usred riječi, nego traži space da bi slomi od 60tog do 90tog znaka. Ukoliko ih ne nađe, ne razlama se string(što se gotovo nikad ne dešava, pošto su tako duge riječi VRLO rijetke). Prenosi i embedded({ FFFFFF }) boje u sljedeći red ukoliko postoje unutar stringa.

Sve top samo else if umesto if
CoA|Logan
Street Runner
pre 5 godina
King of the Jungle wrote on August 31, 2020, 4:59 pm:
Sve top samo else if umesto if

U pravu si, na brzaka sam pisao pa ono. Uglavnom kod testiran i funkcionira 🙂
Nodze
Underboss
pre 3 godine
VaÅ¡e ime na forumu:  Nodze
Komanda x Funkcija : Ping / FPS
 
#include
#include

new pDrunkLevelLast;
new pFPS;
new Text3D:PlayerLabel;

public OnPlayerConnect(playerid)
{
    pDrunkLevelLast = 0;
    pFPS = 0;
    PlayerLabel = Create3DTextLabel("_", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(PlayerLabel, playerid, 0.0, 0.0, 0.75);
}

public OnPlayerDisconnect(playerid)
{
    Delete3DTextLabel(PlayerLabel);
    return 1;
}

ptask asdasd(playerid)
{
    new drunknew;
    drunknew = GetPlayerDrunkLevel(playerid);

    if (drunknew < 100)
    {
        SetPlayerDrunkLevel(playerid, 2000);
    }
    else
    {
        if (pDrunkLevelLast != drunknew)
        {
            new wfps = pDrunkLevelLast - drunknew;
            if ((wfps > 0) && (wfps < 200))
                pFPS = wfps;
            pDrunkLevelLast = drunknew;
        }
    }

    //FPS/Ping
    static tmp;
    format(tmp, sizeof(tmp), "{FFFF00}FPS: {FF0000}%i\n{FFFF00}Ping: {FF0000}%i", pFPS, GetPlayerPing(playerid));
    Update3DTextLabelText(PlayerLabel, 0xFFFFFFFF, tmp);
    return 1;
}

Opis: FPS i PING (3D Text Label) , Lijepo za RP ili TDM
Dodatak:
Credits: Nodze

- Slike: Ne trebaju
Spejs
Hustler
pre 3 godine
- Vaše ime na forumu: Spejs
- Komanda x Funkcija :
IsVehicleOccupied(vehicleid)
{
    foreach (new i : VehicleOccupant) {
        return true;
    }
    return false;
}

- Opis:
Vraća true ako je neko u vozilu (kao (su)vozač), false ako nije.
- Dodatak: Potrebna poslednja verzija YSIa
- Credits: Y_Less
Fergosonn
Made Man
pre 3 godine
Konvertovanje broja mnogo krace  😁
FormatMoney(money)
{
    new str,i;valstr(str,money),i=(money > 0) ? strlen(str)-3 : strlen(str)-4;
    for(; i>0; i-=3) strins(str,".",(money > 0) ? i : i+1,24);
    return str;
}
Spejs
Hustler
pre 3 godine
Fergosonn wrote on January 4, 2023, 8:57 pm:
Konvertovanje broja mnogo krace  😁
FormatMoney(money)
{
    new str,i;valstr(str,money),i=(money > 0) ? strlen(str)-3 : strlen(str)-4;
    for(; i>0; i-=3) strins(str,".",(money > 0) ? i : i+1,24);
    return str;
}

ili
https://github.com/thecodeah/pawn-humanize
Spejs
Hustler
pre 3 godine
- Vaše ime na forumu: Spejs
- Komanda x Funkcija :
Float:GetVehicleSpeed(vehicleid, bool:kmh = true)
{
    new
        Float:vx,
        Float:vy,
        Float:vz,
        Float:speed;
       
    if(!GetVehicleVelocity(vehicleid, vx, vy, vz))
        return 0.0;

    speed = VectorSize(vx, vy, vz);
   
    return kmh ? floatround(speed * 195.12) : floatround(speed * 121.30);
}

- Opis:
Brzina vozila u km/h iki mp/h
Garadooo
Forum Don
pre 3 godine
Spejs wrote on January 6, 2023, 1:14 pm:
- Vaše ime na forumu: Spejs
- Komanda x Funkcija :
Float:GetVehicleSpeed(vehicleid, bool:kmh = true)
{
    new
        Float:vx,
        Float:vy,
        Float:vz,
        Float:speed;
       
    if(!GetVehicleVelocity(vehicleid, vx, vy, vz))
        return 0.0;

    speed = VectorSize(vx, vy, vz);
   
    return kmh ? floatround(speed * 195.12) : floatround(speed * 121.30);
}

- Opis:
Brzina vozila u km/h iki mp/h

Fali ti tajmer od 1ms
Spejs
Hustler
pre 3 godine
Galardo wrote on January 6, 2023, 1:39 pm:
Fali ti tajmer od 1ms

Ja brzinomer pravim na vehicle sync paket 😁
jovaanoviicc17
Shot Caller
pre 2 godine
- Vaše ime na forumu: deksyseksy emmett wajt
- Komanda x Funkcija :
stock SplitPlayerName(const playerid, const part[] = "name" /* part = name/lastname */)
{
new
name,
option;

GetPlayerName(playerid, name, sizeof(name));
option = (!strcmp(part, "name", false) ? 1 : !strcmp(part, "lastname", false) ? 2 : 0xFFFF);

for (new i = 0; i < sizeof(name); i++)
{
if (name == "_") // ovde umesto navodnika stavite apostrof
strdel(name, option == 1 ? i : -1, option == 1 ? sizeof(name) - 1 : i);
}
return name;
}

- Opis:
Odvoji igracevo ime od '_'
- Dodatak: //
- Credits: //

- Slike://

Koristi se npr:
Moje ime na serveru je Emmett_White
SplitPlayerName(playerid, "lastname");

izlaz: White
SplitPlayerName(playerid, "name");

izlaz: Emmett
Spejs
Hustler
pre 2 godine
deksyseksy (mozda emmett?) wrote on February 28, 2023, 9:23 pm:
- Vaše ime na forumu: deksyseksy emmett wajt
- Komanda x Funkcija :
stock SplitPlayerName(const playerid, const part[] = "name" /* part = name/lastname */)
{
new
name,
option;

GetPlayerName(playerid, name, sizeof(name));
option = (!strcmp(part, "name", false) ? 1 : !strcmp(part, "lastname", false) ? 2 : 0xFFFF);

for (new i = 0; i < sizeof(name); i++)
{
if (name == "_") // ovde umesto navodnika stavite apostrof
strdel(name, option == 1 ? i : -1, option == 1 ? sizeof(name) - 1 : i);
}
return name;
}

- Opis:
Odvoji igracevo ime od '_'
- Dodatak: //
- Credits: //

- Slike://

Koristi se npr:
Moje ime na serveru je Emmett_White
SplitPlayerName(playerid, "lastname");

izlaz: White
SplitPlayerName(playerid, "name");

izlaz: Emmett

https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Core/y_utils/y_utils_names.inc

a ne, ovo nema name surname, mb, mislio sam da ima njtf

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum Version 2026.1.001 Atlas