Balkan SA:MP

PAWN skriptanje, gamemodovi, filterskripte, include fajlovi, mape, pluginovi => Razgovor u vezi PAWN - skriptanja => Temu započeo: ricken poslato Februar 22, 2012, 19:11:20 POSLE PODNE

Naslov: [POMOC]
Poruka od: ricken poslato Februar 22, 2012, 19:11:20 POSLE PODNE
Skripta koju koristim:Mod od 0
Detaljan opis problema:Radimo mod od 0.I sada izgleda mod kao DM chat,i kako sada napraviti da samo u blizini vide poruke,a ne svi na serv.
Dio skripte:
Neke slike/video za lakse dobivanje pomoci(neobavezno):
Naslov: Odg: [POMOC]
Poruka od: [M:RP] Williamsâ„¢ poslato Februar 22, 2012, 19:31:40 POSLE PODNE
Kod dela gde se pojavljuje text ('nick' kaze 'text'), stavi ispod te linije ovo

ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);


Mislim da bi to trebalo da radi.. i jos nesto, ako nemas definirano COLOR_FADE1, COLOR_FADE2, COLOR_FADE 3, COLOR_FADE4 i COLOR_FADE5, stavi boje koje ti imas definirane ili stavi hex code te boje koje oces (0xFF...)

Valjda radi. Ako ne, reci. Nisam bas najbolji
Naslov: Odg: [POMOC]
Poruka od: LuKsA poslato Februar 22, 2012, 19:35:53 POSLE PODNE
Stavis proxdetector i returnas na 0.
Naslov: Odg: [POMOC]
Poruka od: ricken poslato Februar 22, 2012, 19:49:05 POSLE PODNE
Evo ovako je u mene
{
   if (realchat)
{
    if(gPlayerLogged[playerid] == 0)
    {
        return 0;
      }
      new string[56];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "(( %s kaze: %s ))", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
return 0;
}
return 1;
}
Naslov: Odg: [POMOC]
Poruka od: [M:RP] Williamsâ„¢ poslato Februar 22, 2012, 19:52:21 POSLE PODNE
Pa trebalo bi raditi.. jesi testao?
Naslov: Odg: [POMOC]
Poruka od: ricken poslato Februar 22, 2012, 19:56:02 POSLE PODNE
Da ali nece da radi...
Naslov: Odg: [POMOC]
Poruka od: [M:RP] Williamsâ„¢ poslato Februar 22, 2012, 20:50:54 POSLE PODNE
Uzmi iz nekog gm chat... evo ti npr ovo:


if(strcmp(cmd, "/local", true) == 0 || strcmp(cmd, "/say", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, "   Niste se prijavili!");
            return 1;
        }
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /local [local chat]");
return 1;
}
if(!IsPlayerInAnyVehicle(playerid))
{
if(PlayerInfo[playerid][pMaskuse] == 1)
{
format(string, sizeof(string), "Stranac kaze: %s", result);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
else
    {
    format(string, sizeof(string), "%s kaze: %s", sendername, result);
    ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
}
else
{
    new carid = GetPlayerVehicleID(playerid);
    if(IsABike(carid) || IsAOBike(carid) || IsAPizzabike(carid) || IsAPlane(carid) || IsABoat(carid) || IsADjubretar(carid) || IsASweeper(carid) || IsAHarvest(carid) || IsADrugHarvest(carid) || IsATank(carid) || pveh == 523 || pveh == 480 || pveh == 567 || pveh == 533 || pveh == 555 || pveh == 539 || pveh == 572 || pveh == 571 || pveh == 530 || pveh == 457 || pveh == 575 || pveh == 536 || pveh == 424)
    {
        if(PlayerInfo[playerid][pMaskuse] == 1)
{
format(string, sizeof(string), "Stranac kaze: %s", result);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
else
{
    format(string, sizeof(string), "%s kaze: %s", sendername, result);
    ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
    }
    else
    {
    if(VehicleWindows[GetPlayerVehicleID(playerid)] == 0)
    {
    if(PlayerInfo[playerid][pMaskuse] == 1)
{
format(string, sizeof(string), "(Zatvoren prozor) Stranac kaze: %s", result);
ProxDetector(10.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
else
{
    format(string, sizeof(string), "(Zatvoren prozor) %s kaze: %s", sendername, result);
    ProxDetector(10.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
}
else
{
    if(PlayerInfo[playerid][pMaskuse] == 1)
{
format(string, sizeof(string), "(Otvoren prozor) Stranac kaze: %s", result);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
else
{
    format(string, sizeof(string), "(Otvoren prozor) %s kaze: %s", sendername, result);
    ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
}
}
}
printf("%s", string);
}
return 1;
}
Naslov: Odg: [POMOC]
Poruka od: [TG:RP]$--L84S--$ poslato Februar 22, 2012, 23:47:37 POSLE PODNE
Jednostano Pod OnPlayerText napravis kako zelis da ti prikazuje  i stavis ProxDetector ....
Naslov: Odg: [POMOC]
Poruka od: ricken poslato Februar 22, 2012, 23:58:45 POSLE PODNE
Citat: [TG]$--L84S--$ poslato Februar 22, 2012, 23:47:37 POSLE PODNE
Jednostano Pod OnPlayerText napravis kako zelis da ti prikazuje  i stavis ProxDetector ....
Pa evo vidi kako je u mene
{
   if (realchat)
{
    if(gPlayerLogged[playerid] == 0)
    {
        return 0;
      }
      new string[56];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "(( %s kaze: %s ))", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
return 0;
}
return 1;
}

Tako sve stavim ali nece.
Naslov: Odg: [POMOC]
Poruka od: MiljanM poslato Februar 23, 2012, 06:42:11 PRE PODNE
Probaj sad. :D

Dodao sam ChatBubble, kod mene je tako i radi.

if (realchat)
{
    if(gPlayerLogged[playerid] == 0)
    {
        return 0;
      }
              new string[56];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "(( %s kaze: %s ))", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
                SetPlayerChatBubble(playerid, text,COLOR_WHITE,50.0,5000);
return 0;
}
return 1;
}
Naslov: Odg: [POMOC]
Poruka od: ricken poslato Februar 23, 2012, 14:26:00 POSLE PODNE
Citat: Frank. poslato Februar 23, 2012, 06:42:11 PRE PODNE
Probaj sad. :D

Dodao sam ChatBubble, kod mene je tako i radi.

if (realchat)
{
    if(gPlayerLogged[playerid] == 0)
    {
        return 0;
      }
              new string[56];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "(( %s kaze: %s ))", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
                SetPlayerChatBubble(playerid, text,COLOR_WHITE,50.0,5000);
return 0;
}
return 1;
}

Neradi ni to. :@ Daj nek netko pomaze ovo mi treba -.-"
Naslov: Odg: [POMOC]
Poruka od: MiljanM poslato Februar 23, 2012, 18:45:58 POSLE PODNE
Et' sad ću ti napisati sve što se kod mene nalazi za to.

Idemo:

Pod newovi dodaj:

new realchat = 1;

Onda pod 'public OnPlayerText' dodaj:

SetPlayerChatBubble(playerid, text, 0x0091FFFF, 100.0, 10000);
if(stringContainsIP(text))


Onda pod forwardovi:

forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);

Onda za svaki slučaj stavi, možda ti ovo omogućava nešto, nisam siguran:


public 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);
//radi = 2.0; //Trigger Radius
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!BigEar[i])
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,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);
}
}
else
{
SendClientMessage(i, col1, string);
}
}
}
}//not connected
return 1;
}
Naslov: Odg: [POMOC]
Poruka od: ricken poslato Februar 23, 2012, 19:02:06 POSLE PODNE
Citat: Frank. poslato Februar 23, 2012, 18:45:58 POSLE PODNE
Et' sad ću ti napisati sve što se kod mene nalazi za to.

Idemo:

Pod newovi dodaj:

new realchat = 1;

Onda pod 'public OnPlayerText' dodaj:

SetPlayerChatBubble(playerid, text, 0x0091FFFF, 100.0, 10000);
if(stringContainsIP(text))


Onda pod forwardovi:

forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);

Onda za svaki slučaj stavi, možda ti ovo omogućava nešto, nisam siguran:


public 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);
//radi = 2.0; //Trigger Radius
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!BigEar[i])
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,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);
}
}
else
{
SendClientMessage(i, col1, string);
}
}
}
}//not connected
return 1;
}

Neradi ...