![:lode:](http://forum.gta-expert.it/public/style_emoticons/default/lode.gif)
[RISOLTO] HELP,Mi serve aiuto a inserire dei comandi.
#2
Inviato il 31 maggio 2007 - 12:12
GetHere utilizzabile solo dagli admin: if(strcmp(cmd,"/gethere",true) == 0) { if(IsPlayerAdmin(playerid) == 1) { new playername[MAX_PLAYER_NAME]; new name[MAX_PLAYER_NAME]; new tmp[256]; new pid; new Float:plx; new Float:ply; new Float:plz; tmp = strtok(cmdtext,idx); if(!strlen(tmp)) { SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /gethere [playerid]"); return 1; } pid = strval(tmp); if(!IsPlayerConnected(pid)) { SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso"); return 1; } GetPlayerName(pid,playername,sizeof(playername)); GetPlayerName(playerid,name, sizeof(name)); GetPlayerPos(playerid, plx, ply, plz); SetPlayerPos(pid, plx, ply, plz); format(string,sizeof(string),"%s ha teletrasportato a se %s .",name,playername); SendClientMessageToAll(0xFF8A00AA,string); return 1; } else { SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin"); } } GetHere utilizzabile da tutti: if(strcmp(cmd,"/gethere",true) == 0) { new playername[MAX_PLAYER_NAME]; new name[MAX_PLAYER_NAME]; new tmp[256]; new pid; new Float:plx; new Float:ply; new Float:plz; tmp = strtok(cmdtext,idx); if(!strlen(tmp)) { SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /gethere [playerid]"); return 1; } pid = strval(tmp); if(!IsPlayerConnected(pid)) { SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso"); return 1; } GetPlayerName(pid,playername,sizeof(playername)); GetPlayerName(playerid,name, sizeof(name)); GetPlayerPos(playerid, plx, ply, plz); SetPlayerPos(pid, plx, ply, plz); format(string,sizeof(string),"%s ha teletrasportato a se %s .",name,playername); SendClientMessageToAll(0xFF8A00AA,string); return 1; }
by Skia
![:ghgh:](http://forum.gta-expert.it/public/style_emoticons/default/ghgh.gif)
![Immagine Postata](http://i233.photobucket.com/albums/ee141/Nitros628/superandro-1.jpg)
Gnappo: in ogni caso prima la donna va tramortita con una clava, lo dice il manuale del bravo amante
1) Non puoi toccare tutti i tuoi denti con la lingua;
2) Tutti i deficienti, dopo aver letto la prima 'verità', la provano;
3) La prima 'verità' è una bugia;
4) Ora stai sorridendo perchè tu sei un deficiente;
5) Metterai questo testo subito nella tua firma per farlo leggere a un altro idiota;
6) Ora c'è uno stupido sorriso sulla tua faccia.
Questa firma pesa tanto (2 tonnellate)
![Immagine Postata](http://forum.gta-expert.com/html/emoticons/ghgh.gif)
#3
Inviato il 31 maggio 2007 - 13:11
fatto da me, lo ha postato sopra Superandro.
Mute
All'inizio dello script:
new mute[MAX_PLAYER_NAME];
Sotto OnPlayerConnect:
public OnPlayerConnect(playerid) {
mute[playerid] = 0;
}
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/mute",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /mute [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
format(string,sizeof(string),"L'admin %s ha mutato %s .",name,playername);
SendClientMessageToAll(0xFF8A00AA,string);
mute[pid] = 1;
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin");
}
}
if(strcmp(cmd,"/unmute",true) == 0) {
if(IsPlayerAdmin(playerid) == 1) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /mute [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
format(string,sizeof(string),"L'admin %s ha smutato %s .",name,playername);
SendClientMessageToAll(0xFF8A00AA,string);
mute[pid] = 0;
return 1;
} else {
SendClientMessage(playerid,0xFF8A00AA,"Devi essere un admin");
}
}
Sotto OnPlayerText:
public OnPlayerText(playerid, text[]) {
if(mute[playerid] == 1) {
SendClientMessage(playerid, 0xFF8A00AA, "Non puoi parlare, sei stato mutato da un'admin");
return 0;
}
}
L'ho fatto ora, nn l'ho testato ma dovrebbe funzionare, in caso contrario fammi sapere.
Goto
if(strcmp(cmd,"/goto",true) == 0) {
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
new Float:pix;
new Float:piy;
new Float:piz;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /goto [playerid]");
return 1;
}
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,0xFF8A00AA,"Questo giocatore non e' connesso");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
GetPlayerPos(pid, pix, piy, piz);
SetPlayerPos(playerid, pix, piy, piz);
format(string,sizeof(string),"%s si e' teletrasportato da %s .",name,playername);
SendClientMessageToAll(0xFF8A00AA,string);
return 1;
}
EDIT: La teamchat è un pochino piu lunga, ora ci lavoro. Devi però dirmi in base a cosa i players fanno parte di un dato team... per esempio in base alla skin, o in base ad un comando tipo /join team 1 o /join team 2 ecc ecc... oppure al personaggio di spawn... capito?
![:ahsese:](http://forum.gta-expert.it/public/style_emoticons/default/ahsese.gif)
#4
Inviato il 31 maggio 2007 - 14:21
(661) : error 017: undefined symbol "cmd"
(667) : error 017: undefined symbol "idx"
(679) : error 017: undefined symbol "string"
(679) : error 017: undefined symbol "string"
(679) : error 029: invalid expression, assumed zero
(679) : fatal error 107: too many error messages on one line
661 = if(strcmp(cmd,"/mute",true) == 0) {
667 = tmp = strtok(cmdtext,idx);
679 = format(string,sizeof(string),"L'admin %s ha mutato %s .",name,playername);
Per i team adotto il /jointeam xD quindi alla selezione del personaggio non puoi scegliere il team.
Ah,un altra cosa, il comando /cd
![:ahsisi:](http://forum.gta-expert.it/public/style_emoticons/default/ahsisi.gif)
EDIT: Provato,non va , in pratica il mute funziona solo su di me,se faccio /mute dice che mi ha mutato(Ma riesco ancora a parlare),se faccio /mute id nn muta e dice che il server non riconosce il comando ._.
![Immagine Postata](http://www.imagestime.com/out.php/i882494_75135BreakingBadmoneybedHuell5pJrx.jpg)
#5
Inviato il 31 maggio 2007 - 14:49
In fondo a tutto lo script:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Sotto a OnPlayerCommandText ci devono essere queste cose:
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
Quello che manca aggiungilo.
/cd
if(strcmp(cmd,"/cd",true) == 0) {
new tmp[256];
new tempo;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /cd [tempo in secondi]");
return 1;
}
tempo = strval(tmp);
if (tempo == 1) {
cd1();
return 1;
}
if (tempo == 2) {
cd2();
return 1;
}
if (tempo == 3) {
cd3();
return 1;
}
if (tempo == 4) {
cd4();
return 1;
}
if (tempo == 5) {
cd5();
return 1;
}
if (tempo == 6) {
cd6();
return 1;
}
if (tempo == 7) {
cd7();
return 1;
}
if (tempo == 8) {
cd8();
return 1;
}
if (tempo == 9) {
cd9();
return 1;
}
if (tempo == 10) {
cd10();
return 1;
}
}
A parte, non vanno sotto nessuna funzione.. per essere sicuro di non sbagliare mettilo completamente alla fine dello script
public cd10() {
GameTextForAll("~b~10", 600, 4);
SetTimer("cd9", 900, 0);
}
public cd9() {
GameTextForAll("~b~9", 600, 4);
SetTimer("cd8", 900, 0);
}
public cd8() {
GameTextForAll("~b~8", 600, 4);
SetTimer("cd7", 900, 0);
}
public cd7() {
GameTextForAll("~b~7", 600, 4);
SetTimer("cd6", 900, 0);
}
public cd6() {
GameTextForAll("~b~6", 600, 4);
SetTimer("cd5", 900, 0);
}
public cd5() {
GameTextForAll("~b~5", 600, 4);
SetTimer("cd4", 900, 0);
}
public cd4() {
GameTextForAll("~b~4", 600, 4);
SetTimer("cd3", 900, 0);
}
public cd3() {
GameTextForAll("~b~3", 600, 4);
SetTimer("cd2", 900, 0);
}
public cd2() {
GameTextForAll("~b~2", 600, 4);
SetTimer("cd1", 900, 0);
}
public cd1() {
GameTextForAll("~b~1", 600, 4);
SetTimer("cd", 900, 0);
}
public cd() {
GameTextForAll("~b~VIA", 600, 4);
}
Questo è assolutamente da testare. Non so se funzionerà. Se ti da degli errori quando compili passami tutto il tuo script
![:ghgh:](http://forum.gta-expert.it/public/style_emoticons/default/ghgh.gif)
Per il TeamChat aspè che ci lavoro... poi adesso devo anke studiare Inglese (fuck), stasera vedo se riesco a fartelo.
#6
Inviato il 31 maggio 2007 - 15:00
Codice corretto (quello ke va sotto OnPlayerText):
public OnPlayerText(playerid, text[]) {
if(mute[playerid] == 1) {
SendClientMessage(playerid, 0xFF8A00AA, "Non puoi parlare, sei stato mutato da un'admin");
return 0;
}
return 1;
}
Il goto e il gethere funzionano invece, sia a me sia a superandro, allo script del pen1 e a quello dell'RLZ Training :-| quindi probabilmente devi aggiungere quelle parti di codice ke ti ho detto nel messaggio precedente... se non dovesse ancora funzionare devi inviarmi lo script completo.
Adesso controllo il /cd [tempo].
EDIT: Testato, funziona a meraviglia anke il /cd [tempo]
![:sese:](http://forum.gta-expert.it/public/style_emoticons/default/sese.gif)
Quindi l'unico errore che tu possa fare è metterli nel posto sbagliato o modificare il mio codice
![:ghgh:](http://forum.gta-expert.it/public/style_emoticons/default/ghgh.gif)
#8
Inviato il 31 maggio 2007 - 15:22
Quote
Ok grazie Sk!a
![:lode:](http://forum.gta-expert.it/public/style_emoticons/default/lode.gif)
Dovessi non dovrei
![:argh:](http://forum.gta-expert.it/public/style_emoticons/default/argh.gif)
Sotto OnPlayerCommandText:
if(strcmp(cmd,"/cdown",true) == 0) {
new tmp[256];
new tempo;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,0xFF8A00AA,"Utilizzo: /cdown [tempo in millisecondi]");
return 1;
}
tempo = strval(tmp);
SetTimer("cdown",tempo,0);
return 1;
}
Ricorda che in questo caso il tempo va espresso in millisecondi, quindi se vuoi 305 secondi devi scrivere /cdown 305000
Alla fine dello script:
public cdown() {
//quello che vuoi
}
Gli altri sei riuscito a farli funzionare?
#10
Inviato il 31 maggio 2007 - 15:46
Quote
Ok,ho fatto funzionare i vari comandi,anche se mi davano error,ho aggiunto new string[286]; visto che non c'era :|
Cmq non ho capito con il /cdown :|
Ah è vero... lo davo per scontato che avessi new string[256]; subito sotto OnPlayerCommandText
![:ahsese:](http://forum.gta-expert.it/public/style_emoticons/default/ahsese.gif)
Cmq cosa non hai capito del /cdown?
![:m:](http://forum.gta-expert.it/public/style_emoticons/default/mellow.gif)
![:ahsisi:](http://forum.gta-expert.it/public/style_emoticons/default/ahsisi.gif)
#11
Inviato il 05 giugno 2007 - 18:14
![Immagine Postata](http://i233.photobucket.com/albums/ee141/Nitros628/superandro-1.jpg)
Gnappo: in ogni caso prima la donna va tramortita con una clava, lo dice il manuale del bravo amante
1) Non puoi toccare tutti i tuoi denti con la lingua;
2) Tutti i deficienti, dopo aver letto la prima 'verità', la provano;
3) La prima 'verità' è una bugia;
4) Ora stai sorridendo perchè tu sei un deficiente;
5) Metterai questo testo subito nella tua firma per farlo leggere a un altro idiota;
6) Ora c'è uno stupido sorriso sulla tua faccia.
Questa firma pesa tanto (2 tonnellate)
![Immagine Postata](http://forum.gta-expert.com/html/emoticons/ghgh.gif)
#13
Inviato il 05 giugno 2007 - 19:20
public OnPlayerText(playerid,text[])
{
if(text[0] == '!') {
new name[24], string[256];
GetPlayerName(playerid, name, 24);
format(string, sizeof(string), "%s(Team Chat): %s", name, text[1]);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(gTeam[i] == gTeam[playerid])
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
return 0;
}
return 1;
}
Funziona semplicemente con il comando !Testo
Va bene con i personaggi presi allo Spawn, cioe che sono da subito nel Team scelto.
#15
Inviato il 05 giugno 2007 - 22:14
Quote
Questa è una Team Chat che ho fatto per il D-Day.
public OnPlayerText(playerid,text[])
{
if(text[0] == '!') {
new name[24], string[256];
GetPlayerName(playerid, name, 24);
format(string, sizeof(string), "%s(Team Chat): %s", name, text[1]);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(gTeam[i] == gTeam[playerid])
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
return 0;
}
return 1;
}
Funziona semplicemente con il comando !Testo
Va bene con i personaggi presi allo Spawn, cioe che sono da subito nel Team scelto.
Come definisco il text?
new text;
semplicemente?
insomma cosa devo mettere a inizio script?
![:lode:](http://forum.gta-expert.it/public/style_emoticons/default/lode.gif)
![Immagine Postata](http://i233.photobucket.com/albums/ee141/Nitros628/superandro-1.jpg)
Gnappo: in ogni caso prima la donna va tramortita con una clava, lo dice il manuale del bravo amante
1) Non puoi toccare tutti i tuoi denti con la lingua;
2) Tutti i deficienti, dopo aver letto la prima 'verità', la provano;
3) La prima 'verità' è una bugia;
4) Ora stai sorridendo perchè tu sei un deficiente;
5) Metterai questo testo subito nella tua firma per farlo leggere a un altro idiota;
6) Ora c'è uno stupido sorriso sulla tua faccia.
Questa firma pesa tanto (2 tonnellate)
![Immagine Postata](http://forum.gta-expert.com/html/emoticons/ghgh.gif)
#16
Inviato il 05 giugno 2007 - 22:31
Quote
Quote
Questa è una Team Chat che ho fatto per il D-Day.
public OnPlayerText(playerid,text[])
{
if(text[0] == '!') {
new name[24], string[256];
GetPlayerName(playerid, name, 24);
format(string, sizeof(string), "%s(Team Chat): %s", name, text[1]);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(gTeam[i] == gTeam[playerid])
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
return 0;
}
return 1;
}
Funziona semplicemente con il comando !Testo
Va bene con i personaggi presi allo Spawn, cioe che sono da subito nel Team scelto.
Come definisco il text?
new text;
semplicemente?
insomma cosa devo mettere a inizio script?
![:lode:](http://forum.gta-expert.it/public/style_emoticons/default/lode.gif)
Non devi mettere niente. Solo quella parte di script dove vuoi e funziona.
#17
Inviato il 05 giugno 2007 - 22:44
Quote
Quote
Quote
-Jackie@05/06/07 - 21:20
Questa è una Team Chat che ho fatto per il D-Day.
public OnPlayerText(playerid,text[])
{
if(text[0] == '!') {
new name[24], string[256];
GetPlayerName(playerid, name, 24);
format(string, sizeof(string), "%s(Team Chat): %s", name, text[1]);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(gTeam[i] == gTeam[playerid])
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
return 0;
}
return 1;
}
Funziona semplicemente con il comando !Testo
Va bene con i personaggi presi allo Spawn, cioe che sono da subito nel Team scelto.
Come definisco il text?
new text;
semplicemente?
insomma cosa devo mettere a inizio script?
![:lode:](http://forum.gta-expert.it/public/style_emoticons/default/lode.gif)
Non devi mettere niente. Solo quella parte di script dove vuoi e funziona. [/b]
Mi dice questo:
(197) : error 017: undefined symbol "text" (197) : warning 215: expression has no effect (197) : error 001: expected token: ";", but found "]" (197) : error 029: invalid expression, assumed zero (197) : fatal error 107: too many error messages on one line
Quote
(198)new name[24], string[256];
(199)GetPlayerName(playerid, name, 24);
(200)format(string, sizeof(string), "%s(Team Chat): %s", name, text[1]);
(201)
(202)for(new i = 0; i < MAX_PLAYERS; i++) {
(203) if(IsPlayerConnected(i)) {
(204) if(gTeam[i] == gTeam[playerid])
(205) SendClientMessage(i, GetPlayerColor(playerid), string);
![Immagine Postata](http://i233.photobucket.com/albums/ee141/Nitros628/superandro-1.jpg)
Gnappo: in ogni caso prima la donna va tramortita con una clava, lo dice il manuale del bravo amante
1) Non puoi toccare tutti i tuoi denti con la lingua;
2) Tutti i deficienti, dopo aver letto la prima 'verità', la provano;
3) La prima 'verità' è una bugia;
4) Ora stai sorridendo perchè tu sei un deficiente;
5) Metterai questo testo subito nella tua firma per farlo leggere a un altro idiota;
6) Ora c'è uno stupido sorriso sulla tua faccia.
Questa firma pesa tanto (2 tonnellate)
![Immagine Postata](http://forum.gta-expert.com/html/emoticons/ghgh.gif)
#18
Inviato il 05 giugno 2007 - 22:48
Quote
Quote
Quote
Quote
-Jackie@05/06/07 - 21:20
Questa è una Team Chat che ho fatto per il D-Day.
public OnPlayerText(playerid,text[])
{
if(text[0] == '!') {
new name[24], string[256];
GetPlayerName(playerid, name, 24);
format(string, sizeof(string), "%s(Team Chat): %s", name, text[1]);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(gTeam[i] == gTeam[playerid])
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
return 0;
}
return 1;
}
Funziona semplicemente con il comando !Testo
Va bene con i personaggi presi allo Spawn, cioe che sono da subito nel Team scelto.
Come definisco il text?
new text;
semplicemente?
insomma cosa devo mettere a inizio script?
![:lode:](http://forum.gta-expert.it/public/style_emoticons/default/lode.gif)
Non devi mettere niente. Solo quella parte di script dove vuoi e funziona.
Mi dice questo:
(197) : error 017: undefined symbol "text" (197) : warning 215: expression has no effect (197) : error 001: expected token: ";", but found "]" (197) : error 029: invalid expression, assumed zero (197) : fatal error 107: too many error messages on one line
Quote
(198)new name[24], string[256];
(199)GetPlayerName(playerid, name, 24);
(200)format(string, sizeof(string), "%s(Team Chat): %s", name, text[1]);
(201)
(202)for(new i = 0; i < MAX_PLAYERS; i++) {
(203) if(IsPlayerConnected(i)) {
(204) if(gTeam[i] == gTeam[playerid])
(205) SendClientMessage(i, GetPlayerColor(playerid), string);
Devi mettere TUTTO questo -.-"
public OnPlayerText(playerid,text[])
{
if(text[0] == '!') {
new name[24], string[256];
GetPlayerName(playerid, name, 24);
format(string, sizeof(string), "%s(Team Chat): %s", name, text[1]);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(gTeam[i] == gTeam[playerid])
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
return 0;
}
return 1;
}
#19
Inviato il 05 giugno 2007 - 22:59
![Immagine Postata](http://i233.photobucket.com/albums/ee141/Nitros628/superandro-1.jpg)
Gnappo: in ogni caso prima la donna va tramortita con una clava, lo dice il manuale del bravo amante
1) Non puoi toccare tutti i tuoi denti con la lingua;
2) Tutti i deficienti, dopo aver letto la prima 'verità', la provano;
3) La prima 'verità' è una bugia;
4) Ora stai sorridendo perchè tu sei un deficiente;
5) Metterai questo testo subito nella tua firma per farlo leggere a un altro idiota;
6) Ora c'è uno stupido sorriso sulla tua faccia.
Questa firma pesa tanto (2 tonnellate)
![Immagine Postata](http://forum.gta-expert.com/html/emoticons/ghgh.gif)