Skripta koju koristim:moja od 0
Detaljan opis problema: pa nez kak da napravim komandu /b al strcp da bude.
Dio skripte: /b
Neke slike/video za lakse dobivanje pomoci(neobavezno):/
Probaj ovako
Citatif(!strcmp(cmdtext, "/b", true, 2))
{
if(!cmdtext[2])return SendClientMessage(playerid, BOJA, "POMOC: /b [OOC CHAT]");
new string[128];
GetPlayerName(playerid,string, sizeof(string));
format(string, sizeof(str), "%s ((%s))", string, cmdtext[2]);
SendClientMessageToAll (BOJA, str);
return 1;
}
Samo ovo "BOJA" zamjeni sa bojom koju hoćeÅ¡.Koju si definirao na poÄetku npr.
Npr stavi CRVENA ako imaš definirano ;)
izbaci erora i
koji error,i kopiraj mi tu linije
ovu cmd sam nasao na google al ovaj mi error izbaci
expected token: ")", but found "return"
Pošto koristim ZCMD procesor komandi, evo ti komanda za /b.Komanda:CMD:b(playerid, params[])
{
new tekst[128],string[128];
if(sscanf(params,"s[128]",tekst)) return SCM(playerid,-1,"Koristi /b tekst");
format(string,128,"(( %s: %s ))",GetName(playerid),tekst);
ProxDetector(20.0, playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
return 1;
}
ProxDetector: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);
//radi = 2.0; //Trigger Radius
for(new i = 0; i < MAX_IGRACA; i++)
{
if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(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;
}
BOJE:#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
Stock:stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
Citat: Adam_Lay poslato Septembar 27, 2014, 15:34:06 POSLE PODNE
Probaj ovako
Citatif(!strcmp(cmdtext, "/b", true, 2))
{
if(!cmdtext[2])return SendClientMessage(playerid, BOJA, "POMOC: /b [OOC CHAT]");
new string[128];
GetPlayerName(playerid,string, sizeof(string));
format(string, sizeof(str), "%s ((%s))", string, cmdtext[2]);
SendClientMessageToAll (BOJA, str);
return 1;
}
Samo ovo "BOJA" zamjeni sa bojom koju hoćeÅ¡.Koju si definirao na poÄetku npr.
Npr stavi CRVENA ako imaš definirano ;)
Funkcija
SendClientMessageToAll (http://wiki.sa-mp.com/wiki/Function:SendClientMessageToAll), nije prava funkcija za ovaj sluÄaj, zbog toga Å¡to Å¡alje poruku svim igracima dok je ovdje potreban radius u kojem ce poslati a to je
ProxDetector riješio.
Citat: Amar Tinjak poslato Septembar 27, 2014, 21:13:34 POSLE PODNE
Pošto koristim ZCMD procesor komandi, evo ti komanda za /b.
Komanda:
CMD:b(playerid, params[])
{
new tekst[128],string[128];
if(sscanf(params,"s[128]",tekst)) return SCM(playerid,-1,"Koristi /b tekst");
format(string,128,"(( %s: %s ))",GetName(playerid),tekst);
ProxDetector(20.0, playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
return 1;
}
ProxDetector:
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);
//radi = 2.0; //Trigger Radius
for(new i = 0; i < MAX_IGRACA; i++)
{
if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(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;
}
BOJE:
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
Stock:
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
Citat: Adam_Lay poslato Septembar 27, 2014, 15:34:06 POSLE PODNE
Probaj ovako
Citatif(!strcmp(cmdtext, "/b", true, 2))
{
if(!cmdtext[2])return SendClientMessage(playerid, BOJA, "POMOC: /b [OOC CHAT]");
new string[128];
GetPlayerName(playerid,string, sizeof(string));
format(string, sizeof(str), "%s ((%s))", string, cmdtext[2]);
SendClientMessageToAll (BOJA, str);
return 1;
}
Samo ovo "BOJA" zamjeni sa bojom koju hoćeÅ¡.Koju si definirao na poÄetku npr.
Npr stavi CRVENA ako imaš definirano ;)
Funkcija SendClientMessageToAll (http://wiki.sa-mp.com/wiki/Function:SendClientMessageToAll), nije prava funkcija za ovaj sluÄaj, zbog toga Å¡to Å¡alje poruku svim igracima dok je ovdje potreban radius u kojem ce poslati a to je ProxDetector rijeÅ¡io.
Istina,moja greška..
al vidi brt ja koristim strcmp za komande kako dasad mjesam pocetnik sam pa neznam
Citat: [BA]DenY poslato Septembar 27, 2014, 22:45:39 POSLE PODNE
al vidi brt ja koristim strcmp za komande kako dasad mjesam pocetnik sam pa neznam
Savjetujem ti da preÄ'eÅ¡ na
ZCMD /
YCMD jer je puno brži i lakši za korištenje . Znaci skini ZCMD include dadoteku te ubaci u
/pawno/include.
Download: ZCMD procesor komandi (http://forum.sa-mp.com/showthread.php?t=91354) .
Nakon toga na vrh skripte
#include <zcmd>
I onda van publica koristi ovaj nacin komandi.
CMD:mojakomanda(playerid, params[])
{
//nesto
return 1;
}