Započeo [CH] Adzax'
•7. Jan. 2014.• Zaključano[Pomoc]Prox Detector
598
pregleda
11
postova
Wheel Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
40 / 100 XP
Početnik(0)
37
Postovi:
16
Teme:
Pridružio se:Nov. 2012
7. Jan. 2014.
Skripta koju koristim: Moja od 0
Detaljan opis problema: Ubacio sam Proxdetector i kada udjem na server opet svi vide ono sto ja pisem,a fino u njemu pise na 16 metara tamo ono potamni boja sve al opet svi vide nista,treba li jos sta dodati osim tog Prox detectora?
Dio skripte:/
Neke slike/video za lakse dobivanje pomoci(neobavezno):/
Detaljan opis problema: Ubacio sam Proxdetector i kada udjem na server opet svi vide ono sto ja pisem,a fino u njemu pise na 16 metara tamo ono potamni boja sve al opet svi vide nista,treba li jos sta dodati osim tog Prox detectora?
Dio skripte:/
Neke slike/video za lakse dobivanje pomoci(neobavezno):/
Wheel Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
40 / 100 XP
Početnik(0)
37
Postovi:
16
Teme:
Pridružio se:Nov. 2012
7. Jan. 2014.
razbu ima vako evo ti cijeli
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
//==============================================================================
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);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) // If the player is within 16 meters
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) // within 8 meters
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) //4 meters
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) //2 meters
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) //1 meter
{
SendClientMessage(i, col5, string);
}
}
else
{
SendClientMessage(i, col1, string);
}
}
}
return 1;
}
Wheel Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
40 / 100 XP
Početnik(0)
37
Postovi:
16
Teme:
Pridružio se:Nov. 2012
Underboss
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
240 / 250 XP
Početnik(0)
666
Postovi:
43
Teme:
Pridružio se:Avg. 2012
7. Jan. 2014.
Ne mora biti 'javna' funkcija, jer ne koristis je u pomocu tajmera / ne pozivas preko CLC.
Primjer koristenja:
stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
new Float:posx, Float:posy, Float:posz, Float:oldposx, Float:oldposy, Float:oldposz, Float:tempposx, Float:tempposy, Float:tempposz, invehicle, virtualworld = GetPlayerVirtualWorld(playerid), interior = GetPlayerInterior(playerid), vehicleid = GetPlayerVehicleID(playerid), ivehicleid;
if(vehicleid) { GetVehiclePos(vehicleid,oldposx,oldposy,oldposz); }
else
{
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
vehicleid = GetPlayerVehicleID(playerid);
}
foreach(Player, i) {
if(GetPlayerVirtualWorld(i) == virtualworld) {
if((GetPlayerInterior(i) == interior)) {
if(vehicleid) {
if(IsPlayerInVehicle(i,vehicleid)) invehicle = 1; }
if(!invehicle) {
if(IsPlayerInAnyVehicle(i)) {
ivehicleid = GetPlayerVehicleID(i);
GetVehiclePos(ivehicleid,posx,posy,posz); }
else {
GetPlayerPos(i,posx,posy,posz); }
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) SCM(i, col1, string);
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) SCM(i, col2, string);
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) SCM(i, col3, string);
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) SCM(i, col4, string);
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) SCM(i, col5, string);
}
else SCM(i, col1, string);
}
}
}
return 1;
}Primjer koristenja:
new f_Name;
GetPlayerName(playerid, f_Name, MAX_PLAYER_NAME);
new f_String[20+MAX_PLAYER_NAME];
format(fString, sizeof fString, "%s pali motor vozila.", f_Name);
ProxDetector(30.0, playerid, fString, 123450, 678950, 1357940, 2468040, 1526370);Wheel Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
40 / 100 XP
Početnik(0)
37
Postovi:
16
Teme:
Pridružio se:Nov. 2012
7. Jan. 2014.
sve ja to kontam al kako cu napravit kad igrac pise jedan sa drugim na IC chat da ne vide svi to meni treba
OG Legend
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosAktivan Član
23 / 250 XP
Početnik(2)
3,748
Postovi:
73
Teme:
Pridružio se:Jan. 2012
7. Jan. 2014.
new realchat = 1;ovo dodaj pod OnPlayertext.
if(realchat)
{
new chattext = strlen(text),string;
for(new i = 0; i format(string, sizeof(string), "{FFFF00}(({FFFFFF} | {FFFF00}%s: {FFFFFF}%s{FFFF00}))", GetName(playerid), text);
ProxDetector(20.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 0;
}stock GetName(playerid)
{
new name;
GetPlayerName(playerid, name, sizeof(name));
return name;
}Wheel Man
Balkan SA:MP
SA-MP Doprinos
Balkan SA:MP
SA-MP DoprinosNovi Član
40 / 100 XP
Početnik(0)
37
Postovi:
16
Teme:
Pridružio se:Nov. 2012
Morate biti prijavljeni da biste odgovorili na ovu temu.
Prijava