GTA-Expert Forum: [Help]Ban Kick Score - GTA-Expert Forum

Salta al contenuto

Pagina 1 di 1
  • Non puoi iniziare una nuova discussione
  • Questa discussione e' chiusa

[Help]Ban Kick Score

#1 L'utente è offline   .ReVo^ 

  • Criminale
  • Gruppo: Utenti
  • Messaggi: 1402
  • Iscritto il: 20/11/08
  • GTA Preferito:GTA: TBoGT

Inviato il 01 luglio 2009 - 21:04

Mi servirebbero 3 funzioni

1.) /ban ID causa
2.) /kick ID causa
3.) /score ID PUNTi

Grazie
Immagine Postata
0

#2 L'utente è offline   Skiaffo 

  • Boss
  • Gruppo: Moderatori
  • Messaggi: 14732
  • Iscritto il: 08/12/05
  • Provenienza:Urbs Aeterna
  • GTA Preferito:GTA V

Inviato il 01 luglio 2009 - 22:29

Quote

Originally posted by [SFD
Marco,01/07/09 - 22:04]Mi servirebbero 3 funzioni

1.) /ban ID causa
2.) /kick ID causa
3.) /score ID PUNTi

Grazie

Per il ban e il kick guarda questa discussione, e riadatta il codice alla tua struttura dello script. Se non ci riesci e ti serve aiuto dimmelo.

Per il score ID dammi qualche minuto che te lo faccio.
"Audentes Fortuna iuvat"
0

#3 L'utente è offline   gamehosting 

  • Vandalo
  • Gruppo: Utenti
  • Messaggi: 52
  • Iscritto il: 30/06/09

Inviato il 01 luglio 2009 - 23:24

Quel kick li è progettato per il pen (credo), non va bene generalmente
0

#4 L'utente è offline   Skiaffo 

  • Boss
  • Gruppo: Moderatori
  • Messaggi: 14732
  • Iscritto il: 08/12/05
  • Provenienza:Urbs Aeterna
  • GTA Preferito:GTA V

Inviato il 01 luglio 2009 - 23:28

Quote

Originally posted by gamehosting@02/07/09 - 00:24
Quel kick li è progettato per il pen (credo), non va bene generalmente

Infatti ho detto che deve riadattarlo alla sua GM.

Cmq ecco lo /score id punti

	if(strcmp(cmd, "/score", true) == 0) {
  tmp = strtok(cmdtext, idx);
  new pid;
  new punti;
  if(!strlen(tmp)) {
  	SendClientMessage(playerid, 0xFF8A00AA, "Utilizzo: /score [playerid] [punti]");
  	return 1;
  }
  pid = strval(tmp);
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) {
  	SendClientMessage(playerid, 0xFF8A00AA, "Utilizzo: /score [playerid] [punti]");
  	return 1;
  }
  	punti = strval(tmp);
  if (IsPlayerConnected(pid)) {
  	SetPlayerScore(pid, punti);
  } else {
  	SendClientMessage(playerid, 0xFF8A00AA, "Il player non è connesso");
  }
  return 1;
	}


Non l'ho testato, dimmi se funziona.
"Audentes Fortuna iuvat"
0

#5 L'utente è offline   SoeH 

  • Teppista
  • Gruppo: Utenti
  • Messaggi: 254
  • Iscritto il: 30/11/08

Inviato il 02 luglio 2009 - 01:22

Mi ha copiato l'avatar ._."
Firma cancellata perchè fuori norma, leggi il regolamento. Il codice precedente è stato inviato per Messaggio Privato.
0

#6 L'utente è offline   .ReVo^ 

  • Criminale
  • Gruppo: Utenti
  • Messaggi: 1402
  • Iscritto il: 20/11/08
  • GTA Preferito:GTA: TBoGT

Inviato il 02 luglio 2009 - 09:06

rofl non sapevo ke era tuo lo trovato su un forum comunque ora provo

edit:
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(409) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(409) : error 006: must be assigned to an array
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(412) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(416) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(417) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(417) : error 006: must be assigned to an array
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(418) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(422) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(431) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(435) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(436) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(439) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(442) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(446) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(453) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(460) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(464) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(467) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(470) : error 021: symbol already defined: "format"
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(472) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(475) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(481) : error 021: symbol already defined: "name"
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(483) : error 021: symbol already defined: "SetPlayerInterior"
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(487) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(491) : error 010: invalid function or declaration
C:\Documents and Settings\Marco\Desktop\samp02Xserver.win322\gamemodes\dm2.pwn(493) : error 021: symbol already defined: "astring"
mi da questi errori pure se metto
new tmp;
niente
Immagine Postata
0

#7 L'utente è offline   ~>Snake95<~ 

  • Cacciatore di taglie
  • Gruppo: Utenti
  • Messaggi: 1253
  • Iscritto il: 06/02/08
  • GTA Preferito:Sconosciuto

Inviato il 02 luglio 2009 - 11:49

Quote

Originally posted by SoeH@02/07/09 - 02:22
Mi ha copiato l'avatar ._."

Evita.
Al prossimo OT chiudo.


Sicuro di avere lo strtok?
Immagine Postata
0

#8 L'utente è offline   _All3Xz_ 

  • Criminale
  • Gruppo: Utenti
  • Messaggi: 1512
  • Iscritto il: 05/01/09
  • GTA Preferito:GTA: San Andreas

Inviato il 02 luglio 2009 - 14:00

Non c'è lo strock -m
My Works
[FS]_All3Xz_ Anti-Cheat 4
[FS]_All3Xz_ Anti-Cheat 7
[FS]_All3Xz_ Anti-Cheat 8
[GM] PVCM Training 0.? (MySQL)
[APP]_All3Xz_ NPC Generator
[GUIDA] Leggere da file usando dini
[GUIDA] Scripting GTA:IV - Callbacks
[GM] PVCM Training 1 (MySQL)
[GM] PVCM A/D
[GUIDA] Leggere da file usandi dini 2
0

#9 L'utente è offline   gamehosting 

  • Vandalo
  • Gruppo: Utenti
  • Messaggi: 52
  • Iscritto il: 30/06/09

Inviato il 02 luglio 2009 - 14:04

il codice che ha scritto è "per la pen", posta tutta la tua gm, dipende da come è stato iniziato onplayercommendtext. Nella pen all'inizio vengono fatte operazioni che sono quasi sempre utili in tutte le funzioni successive. Prova a vedere se così va


if(strcmp("/score",cmdtext, true) == 0) {
new tmp[256], idx;
  tmp = strtok(cmdtext, idx);
 new pid;
 new punti;
 if(!strlen(tmp)) {
  SendClientMessage(playerid, 0xFF8A00AA, "Utilizzo: /score [playerid] [punti]");
  return 1;
 }
 pid = strval(tmp);
 tmp = strtok(cmdtext, idx);
 if(!strlen(tmp)) {
  SendClientMessage(playerid, 0xFF8A00AA, "Utilizzo: /score [playerid] [punti]");
  return 1;
 }
  punti = strval(tmp);
 if (IsPlayerConnected(pid)) {
  SetPlayerScore(pid, punti);
 } else {
  SendClientMessage(playerid, 0xFF8A00AA, "Il player non è connesso");
 }
 return 1;
}

0

#10 L'utente è offline   .ReVo^ 

  • Criminale
  • Gruppo: Utenti
  • Messaggi: 1402
  • Iscritto il: 20/11/08
  • GTA Preferito:GTA: TBoGT

Inviato il 02 luglio 2009 - 14:19

-edit-
Immagine Postata
0

#11 L'utente è offline   Skiaffo 

  • Boss
  • Gruppo: Moderatori
  • Messaggi: 14732
  • Iscritto il: 08/12/05
  • Provenienza:Urbs Aeterna
  • GTA Preferito:GTA V

Inviato il 04 luglio 2009 - 11:04

Quote

Originally posted by gamehosting@02/07/09 - 15:04
il codice che ha scritto è "per la pen", posta tutta la tua gm, dipende da come è stato iniziato onplayercommendtext. Nella pen all'inizio vengono fatte operazioni che sono quasi sempre utili in tutte le funzioni successive. Prova a vedere se così va


if(strcmp("/score",cmdtext, true) == 0) {
new tmp[256], idx;
  tmp = strtok(cmdtext, idx);
 new pid;
 new punti;
 if(!strlen(tmp)) {
  SendClientMessage(playerid, 0xFF8A00AA, "Utilizzo: /score [playerid] [punti]");
  return 1;
 }
 pid = strval(tmp);
 tmp = strtok(cmdtext, idx);
 if(!strlen(tmp)) {
  SendClientMessage(playerid, 0xFF8A00AA, "Utilizzo: /score [playerid] [punti]");
  return 1;
 }
  punti = strval(tmp);
 if (IsPlayerConnected(pid)) {
  SetPlayerScore(pid, punti);
 } else {
  SendClientMessage(playerid, 0xFF8A00AA, "Il player non è connesso");
 }
 return 1;
}

no, lo score nn l'ho fatto per la pen, è applicabile a qualsiasi script. però gli serve lo strtok, ovvero questo:

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;
}


Aggiungilo fuori da qualsiasi evento. Per esempio in fondo allo script.
"Audentes Fortuna iuvat"
0

#12 L'utente è offline   Daddiu 

  • Teppista
  • Gruppo: Utenti
  • Messaggi: 219
  • Iscritto il: 28/07/08

Inviato il 04 luglio 2009 - 13:56

Quote

Originally posted by [SFD]Marco@01/07/09 - 22:04
Mi servirebbero 3 funzioni

1.) /ban ID causa
2.) /kick ID causa
3.) /score ID PUNTi

Grazie

per 1 e 2: devi avere sempre lo strtok(senno nn ti funziona)

all'inizio dell'onplayercommandtext metti:

 new cmd[256],idx;
cmd = strtok(cmdtext,idx);


e dentro onplayecommandtext metti:

//kick
if(strcmp(cmd, "/kick", true) == 0)
{
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
if(IsPlayerAdmin(playerid) == 1) {
tmp = strtok(cmdtext,idx);
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,COLOR_RED,"Questo giocatore non e' connesso");
return 1;
}
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_GREEN, "USAGE: /kick [playerid] [motivo]");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
new string[256];
format(string, sizeof(string), "L'admin %s ha kickato %s [motivo:%s]",name,playername,cmdtext[idx]);
SendClientMessageToAll(0xFFFF00AA, string);
return Kick(pid);
}
return 1;
}

//ban
if(strcmp(cmd, "/ban", true) == 0)
{
new playername[MAX_PLAYER_NAME];
new name[MAX_PLAYER_NAME];
new tmp[256];
new pid;
if(IsPlayerAdmin(playerid) == 1) {
tmp = strtok(cmdtext,idx);
pid = strval(tmp);
if(!IsPlayerConnected(pid)) {
SendClientMessage(playerid,COLOR_RED,"Questo giocatore non e' connesso");
return 1;
}
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_GREEN, "USAGE: /ban [playerid] [motivo]");
return 1;
}
GetPlayerName(pid,playername,sizeof(playername));
GetPlayerName(playerid,name, sizeof(name));
new string[256];
format(string, sizeof(string), "L'admin %s ha bannato %s [motivo:%s]",name,playername,cmdtext[idx]);
SendClientMessageToAll(0xFFFF00AA, string);
return Ban(pid);
}
return 1;
}


l'ho fatto ora.. nn l'ho testato
Immagine Postata

Viva ricky

[18:23] [ISD]RickyzZz: tu
[18:23] [ISD]RickyzZz: sei
[18:23] [ISD]RickyzZz: pr0
[18:23] [ISD]RickyzZz:
[18:23] [ISD]RickyzZz: io njo
[18:23] [ISD]RickyzZz:
[18:23] ^-Daddiu-^: pr0 è dire tanto
[18:23] ^-Daddiu-^: me la cavicchio
[18:23] [ISD]RickyzZz: accetta.
[18:23] ^-Daddiu-^: ma nn sono un granchè
[18:23] ^-Daddiu-^: nn m'arriva nnt
[18:23] [ISD]RickyzZz: se tu
[18:24] [ISD]RickyzZz: te la cavicchi
[18:24] [ISD]RickyzZz: io sono gay
0

#13 L'utente è offline   gamehosting 

  • Vandalo
  • Gruppo: Utenti
  • Messaggi: 52
  • Iscritto il: 30/06/09

Inviato il 04 luglio 2009 - 14:45

Quote

Originally posted by Skiaffo+04/07/09 - 12:04

Quote

(Skiaffo @ 04/07/09 - 12:04)
-gamehosting
@02/07/09 - 15:04
il codice che ha scritto è "per la pen", posta tutta la tua gm, dipende da come è stato iniziato onplayercommendtext. Nella pen all'inizio vengono fatte operazioni che sono quasi sempre utili in tutte le funzioni successive. Prova a vedere se così va


if(strcmp("/score",cmdtext, true) == 0) {
new tmp[256], idx;
  tmp = strtok(cmdtext, idx);
 new pid;
 new punti;
 if(!strlen(tmp)) {
  SendClientMessage(playerid, 0xFF8A00AA, "Utilizzo: /score [playerid] [punti]");
  return 1;
 }
 pid = strval(tmp);
 tmp = strtok(cmdtext, idx);
 if(!strlen(tmp)) {
  SendClientMessage(playerid, 0xFF8A00AA, "Utilizzo: /score [playerid] [punti]");
  return 1;
 }
  punti = strval(tmp);
 if (IsPlayerConnected(pid)) {
  SetPlayerScore(pid, punti);
 } else {
  SendClientMessage(playerid, 0xFF8A00AA, "Il player non è connesso");
 }
 return 1;
}

no, lo score nn l'ho fatto per la pen, è applicabile a qualsiasi script. però gli serve lo strtok, ovvero questo:

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;
}


Aggiungilo fuori da qualsiasi evento. Per esempio in fondo allo script. [/b]

Per come l'avevi scritto all'inizio, non sarebbe funzionato neanche se ci fosse stato l'strtok.
0

#14 L'utente è offline   Skiaffo 

  • Boss
  • Gruppo: Moderatori
  • Messaggi: 14732
  • Iscritto il: 08/12/05
  • Provenienza:Urbs Aeterna
  • GTA Preferito:GTA V

Inviato il 04 luglio 2009 - 15:45

Non avevo messo questo new tmp[256], idx;
perche di solito lo si mette subito sotto OnPlayerCommandText, non in ogni singolo comando...
"Audentes Fortuna iuvat"
0

Pagina 1 di 1
  • Non puoi iniziare una nuova discussione
  • Questa discussione e' chiusa

1 utenti stanno leggendo questa discussione
0 utenti, 1 ospiti, 0 utenti anonimi