Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2013-05-18, 09:50


nors56







Wiek: 28
Na forum: 4775 dni
Posty: 46
Nick w MP: Nors



Respekt: 50

problem Z komend? /daj_dj Prosze pom??cie mi Z tym


warning 219: local variable "string2" shadows a variable at a preceding level
warning 219: local variable "string" shadows a variable at a preceding level
error 030: compound statement not closed at the end of file (started at line 79)

Prosz? Pom??cie Oto M?j Kod:


#include <a_samp>
#include <dudb>
#include <dini>

new gPlayerClass[MAX_PLAYERS];
new gTeam[MAX_PLAYERS];
new wDJ[MAX_PLAYERS];

//========== - Definicje - =====================
#define TEAM_DJ 1

#define DJ "DJ.ini"

#pragma tabsize 0



public OnPlayerCommandText(playerid, cmdtext[])
{
LINIA 79: new idx;
new string[256];
new string2[256];
new cmd[256];
new mpt[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/daj_dj", true) == 0 && IsPlayerAdmin(playerid)){
new string2[256];
string = strtok(cmdtext, idx);
if(!strlen(string)) {
SendClientMessage(playerid, COLOR_YELLOW, "Wpisz: /daj_DJ [nick]");
return 1;
}
new nick[256];
nick = string;
format(string2, sizeof(string2), "%s zostal zatrudniony jako Dj", string);
SendClientMessage(playerid, COLOR_GREEN, string2);
string = strtok(cmdtext, idx);
dini_Set(DJ, nick, "1");
return 1;
}

if(strcmp(cmd, "/usun_dj", true) == 0 && IsPlayerAdmin(playerid)){
new string[256];
string = strtok(cmdtext, idx);
if(!strlen(string)) {
SendClientMessage(playerid, COLOR_YELLOW, "Wpisz: /usun_policja [nick]");
return 1;
}
new nick[256];
nick = string;
format(string2, sizeof(string2), "%s zostal zwolniony jako Dj", string);
SendClientMessage(playerid, COLOR_ZIELONY, string2);
string = strtok(cmdtext, idx);
dini_Set(DJ, nick, "0");
return 1;
}

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 10:28


bartek2227







Wiek: 29
Na forum: 5765 dni
Posty: 66
Nick w MP: Elvis

Piwa: 1777

Respekt: 107
Respekt: 107

Kod:

public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new string[256];
new string2[256];
new cmd[256];
new mpt[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/daj_dj", true) == 0 && IsPlayerAdmin(playerid)){
string = strtok(cmdtext, idx);
if(!strlen(string)) {
SendClientMessage(playerid, COLOR_YELLOW, "Wpisz: /daj_DJ [nick]");
return 1;
}
new nick[256];
nick = string;
format(string2, sizeof(string2), "%s zostal zatrudniony jako Dj", string);
SendClientMessage(playerid, COLOR_GREEN, string2);
string = strtok(cmdtext, idx);
dini_Set(DJ, nick, "1");
return 1;
}

if(strcmp(cmd, "/usun_dj", true) == 0 && IsPlayerAdmin(playerid)){
string = strtok(cmdtext, idx);
if(!strlen(string)) {
SendClientMessage(playerid, COLOR_YELLOW, "Wpisz: /usun_policja [nick]");
return 1;
}
new nick[256];
nick = string;
format(string2, sizeof(string2), "%s zostal zwolniony jako Dj", string);
SendClientMessage(playerid, COLOR_ZIELONY, string2);
string = strtok(cmdtext, idx);
dini_Set(DJ, nick, "0");
return 1;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 10:37


nors56







Wiek: 28
Na forum: 4775 dni
Posty: 46
Nick w MP: Nors



Respekt: 50

Ale Stary Nie wiem oco chodzi ale jest problem z tym:
new idx;

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 11:07


Sillence







Wiek: 26
Na forum: 5157 dni
Posty: 1514
Nick w MP: Sillence

Piwa: 1517

Respekt: 416,3
Respekt: 416,3

nors56, musisz zdefiniowa?:
Kod:

new idx;


Pozdrawiam :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 11:20


nors56







Wiek: 28
Na forum: 4775 dni
Posty: 46
Nick w MP: Nors



Respekt: 50

Wiesz ja dopiero zaczynam nie ale podaj definicje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 11:25


Sillence







Wiek: 26
Na forum: 5157 dni
Posty: 1514
Nick w MP: Sillence

Piwa: 1517

Respekt: 416,3
Respekt: 416,3

nors56, Bartek 3@Up poda? poprawny kod, zamie? go ze swoim ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 11:33


nors56







Wiek: 28
Na forum: 4775 dni
Posty: 46
Nick w MP: Nors



Respekt: 50

Ale podmienilem i problem z linia 316 bo wstawilem to do mapy



public OnPlayerCommandText(playerid, cmdtext[])
{
linia 316.new idx;
new string[256];
new string2[256];
new cmd[256];
new mpt[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/daj_dj", true) == 0 && IsPlayerAdmin(playerid)){
string = strtok(cmdtext, idx);
if(!strlen(string)) {
SendClientMessage(playerid, COLOR_YELLOW, "Wpisz: /daj_DJ [nick]");
return 1;
}
new nick[256];
nick = string;
format(string2, sizeof(string2), "%s zostal zatrudniony jako Dj", string);
SendClientMessage(playerid, COLOR_GREEN, string2);
string = strtok(cmdtext, idx);
dini_Set(DJ, nick, "1");
return 1;
}

if(strcmp(cmd, "/usun_dj", true) == 0 && IsPlayerAdmin(playerid)){
string = strtok(cmdtext, idx);
if(!strlen(string)) {
SendClientMessage(playerid, COLOR_YELLOW, "Wpisz: /usun_policja [nick]");
return 1;
}
new nick[256];
nick = string;
format(string2, sizeof(string2), "%s zostal zwolniony jako Dj", string);
SendClientMessage(playerid, COLOR_ZIELONY, string2);
string = strtok(cmdtext, idx);
dini_Set(DJ, nick, "0");
return 1;
}

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 11:45


Sillence







Wiek: 26
Na forum: 5157 dni
Posty: 1514
Nick w MP: Sillence

Piwa: 1517

Respekt: 416,3
Respekt: 416,3

nors56, Jaka to linijka ta twoja 316 oraz podaj ten error.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 11:46


IgrexolonO







Wiek: 34
Na forum: 6810 dni
Posty: 1386

Piwa: 1062

Respekt: 651,8
Respekt: 651,8Respekt: 651,8

http://wiki.sa-mp.com/wiki/Using_strcmp()

Kod:

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[30];
new idx;
cmd = strtok(cmdtext, idx);

if(strcmp(cmd, "/daj_dj", true) == 0 && IsPlayerAdmin(playerid))
{
new tmp[30];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "Wpisz: /daj_DJ [nick]"), 1;
if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, -1, "Szmato, nie ma tutaj takiego gracza"), 1;

new stringah[128];
format(stringah, sizeof(stringah), "%s zosta? zatrudniony jako peda? na posy?ki.", pName_(strval(tmp));
SendClientMessage(playerid, -1, stringah);
dini_Set(DJ, pName_(strval(tmp)), "1");
return 1;
}

if(strcmp(cmd, "/usun_dj", true) == 0 && IsPlayerAdmin(playerid))
{
new tmp[30];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "Wpisz: /usun_DJ [nick]"), 1;
if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, -1, "Szmato, nie ma tutaj takiego gracza"), 1;

new stringah[128];
format(stringah, sizeof(stringah), "%s zostal zwolniony z pozycji peda?a na posy?ki, za ma?o si? stara?.", pName_(strval(tmp)));
SendClientMessage(playerid, -1, stringah);
dini_Set(DJ, pName_(strval(tmp)), "0");
return 1;
}
return 1;
}

stock pName_(pid)
{
new n[24];
GetPlayerName(pid, n, 24);
return n;
}

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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 11:54


nors56







Wiek: 28
Na forum: 4775 dni
Posty: 46
Nick w MP: Nors



Respekt: 50

"Kopcioo" napisał/a:

nors56, Jaka to linijka ta twoja 316 oraz podaj ten error.


new idx; To jest moja linijka 316

error 030: compound statement not closed at the end of file (started at line 316)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 11:55


IgrexolonO







Wiek: 34
Na forum: 6810 dni
Posty: 1386

Piwa: 1062

Respekt: 651,8
Respekt: 651,8Respekt: 651,8

"nors56" napisał/a:

"Kopcioo" napisał/a:

nors56, Jaka to linijka ta twoja 316 oraz podaj ten error.


new idx; To jest moja linijka 316

error 030: compound statement not closed at the end of file (started at line 316)


Da?em Ci gotowy, zoptymalizowany kod, na co czekasz?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 12:02


nors56







Wiek: 28
Na forum: 4775 dni
Posty: 46
Nick w MP: Nors



Respekt: 50

"IgrexolonO" napisał/a:

"nors56" napisał/a:

"Kopcioo" napisał/a:

nors56, Jaka to linijka ta twoja 316 oraz podaj ten error.


new idx; To jest moja linijka 316

error 030: compound statement not closed at the end of file (started at line 316)


Da?em Ci gotowy, zoptymalizowany kod, na co czekasz?


____________________________________________________________________
W twoim kodzie mam te b??dy:
pawno\include\dini.inc(53) : error 017: undefined symbol "strlen"
pawno\include\dini.inc(53) : warning 215: expression has no effect
pawno\include\dini.inc(53) : error 001: expected token: ";", but found ")"
pawno\include\dini.inc(53) : error 029: invalid expression, assumed zero
pawno\include\dini.inc(53) : fatal error 107: too many error messages on one line
Problem rozwi?zany z wszystkim opr?cz jednego
C:\Users\kacper\Desktop\serwery\Serwer RealLife SAMP\filterscripts\DJ.pwn(4) : fatal error 100: cannot read from file: "strlen"

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 12:11


IgrexolonO







Wiek: 34
Na forum: 6810 dni
Posty: 1386

Piwa: 1062

Respekt: 651,8
Respekt: 651,8Respekt: 651,8

"nors56" napisał/a:


W twoim kodzie mam te b??dy:
pawno\include\dini.inc(53) : error 017: undefined symbol "strlen"
pawno\include\dini.inc(53) : warning 215: expression has no effect
pawno\include\dini.inc(53) : error 001: expected token: ";", but found ")"
pawno\include\dini.inc(53) : error 029: invalid expression, assumed zero
pawno\include\dini.inc(53) : fatal error 107: too many error messages on one line


To s? b??dy z Twojego includa dini, nie z mojego kodu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 12:12


nors56







Wiek: 28
Na forum: 4775 dni
Posty: 46
Nick w MP: Nors



Respekt: 50

"IgrexolonO" napisał/a:

"nors56" napisał/a:


W twoim kodzie mam te b??dy:
pawno\include\dini.inc(53) : error 017: undefined symbol "strlen"
pawno\include\dini.inc(53) : warning 215: expression has no effect
pawno\include\dini.inc(53) : error 001: expected token: ";", but found ")"
pawno\include\dini.inc(53) : error 029: invalid expression, assumed zero
pawno\include\dini.inc(53) : fatal error 107: too many error messages on one line


To s? b??dy z Twojego includa dini, nie z mojego kodu.


Teraz mam tylko fatal error 100: cannot read from file: "strlen"

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-18, 12:15


IgrexolonO







Wiek: 34
Na forum: 6810 dni
Posty: 1386

Piwa: 1062

Respekt: 651,8
Respekt: 651,8Respekt: 651,8

"nors56" napisał/a:

"IgrexolonO" napisał/a:

"nors56" napisał/a:


W twoim kodzie mam te b??dy:
pawno\include\dini.inc(53) : error 017: undefined symbol "strlen"
pawno\include\dini.inc(53) : warning 215: expression has no effect
pawno\include\dini.inc(53) : error 001: expected token: ";", but found ")"
pawno\include\dini.inc(53) : error 029: invalid expression, assumed zero
pawno\include\dini.inc(53) : fatal error 107: too many error messages on one line


To s? b??dy z Twojego includa dini, nie z mojego kodu.


Teraz mam tylko fatal error 100: cannot read from file: "strlen"


Og?lnie, to chcia?bym Ci? skomentowa? jak PSA, ale najwyra?niej nie ma takiego sensu. Od kiedy jedna funkcja strlen, kt?ra jest domy?lnie wpisana w SA-MPie, powinna by? wpisywana w list? includ?w? Aha.. Poka? ca?y kod.

Postaw piwo autorowi tego posta
 

 
Tagi: dodaj
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » PAWN » [INNE] DODAJ DJ Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku