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):
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
Stavis proxdetector i returnas na 0.
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;
}
Pa trebalo bi raditi.. jesi testao?
Da ali nece da radi...
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;
}
Jednostano Pod OnPlayerText napravis kako zelis da ti prikazuje i stavis ProxDetector ....
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.
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;
}
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 -.-"
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;
}
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 ...