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

Wysłany: 2015-02-12, 19:47


Pimpek2







Wiek: 29
Na forum: 4134 dni
Posty: 82
Nick w MP: ElPablo

Piwa: 1

Respekt: 60

Co z??go jest w tej komendzie?:

http://pastebin.com/s9FrLNJN

jest to komenda kt?ra w strcmp dzia?a?? poprawnie a tu juz nie..
wgl po przejsciu mam problem z wieloma cmd :/

Jak temu zapomiec mianowicie ta komenda szaleja a to urywa literke a to bierze konc?wk? a to pocz?tek nicku gracza :/

Du?o wiecej mam problem?w.


za pomoc piwko..


Nic nie daje zmiana z cmdtext na params.

ju? z params zmiania?em na cmdtext

Ostatnio zmieniony przez Pimpek2 2015-02-13, 14:45, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-12, 19:50


IgrexolonO







Wiek: 34
Na forum: 6809 dni
Posty: 1386

Piwa: 1062

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

Kod:

CMD:dodaj_policja(playerid, cmdtext[])
{
if(!IsPlayerAdmin(playerid)) return true;
new string2[128];
format(string2, sizeof(string2), "Gracz %s zosta? dodany do Policji!", cmdtext);
SendClientMessage(playerid, ZIELONY, string2);
DOF2_SetString(POLICJA, cmdtext, "1");
return true;
}


poza tym, o ile dobrze pami?tam podstawowe zcmd nie ogarnia?o "_"

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-13, 14:47


Pimpek2







Wiek: 29
Na forum: 4134 dni
Posty: 82
Nick w MP: ElPablo

Piwa: 1

Respekt: 60

ok dzi?ki dzia?a.:

Jak mo?esz to pom?? w tej cmd te?:

CMD:s(playerid, cmdtext[])
{
new string[256];
strmid(mpt,cmdtext,2,strlen(cmdtext));
if(!strlen(mpt)) {
SendClientMessage(playerid, COLOR_YELLOW, "/s [text]");
return 1;
}
format(string, sizeof(string), "%s:%s",PlayerName(playerid), mpt);
ProxDetector(20.0, playerid, string, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
return 1;
}

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-13, 15:28


IgrexolonO







Wiek: 34
Na forum: 6809 dni
Posty: 1386

Piwa: 1062

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

daj wszystkie komendy od razu to Ci zrobie za jednym razem o.o

Kod:

CMD:s(playerid, p[]) {
if(isnull(p)) return SendClientMessage(playerid, COLOR_YELLOW, "/s [text]");
new string[128];
format(string, sizeof(string), "%s:%s", PlayerName(playerid), p);
ProxDetector(20.0, playerid, string, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
return true;
}


Ostatnio zmieniony przez IgrexolonO 2015-02-13, 16:49, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-13, 15:39


Pimpek2







Wiek: 29
Na forum: 4134 dni
Posty: 82
Nick w MP: ElPablo

Piwa: 1

Respekt: 60

ok tu je masz:
http://pastebin.com/GuCqjg0c

a czemu gdy wpisze samo /s to na czacie wyskakuje
[nick]:
poprostu chodzi o to ze powinno wyskoczyc /s [text] :P

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-13, 16:27


IgrexolonO







Wiek: 34
Na forum: 6809 dni
Posty: 1386

Piwa: 1062

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

Kod:

CMD:posilki(playerid, p[]) {
if(Praca[playerid] != TEAM_POLICJA) return true;
if(isnull(p)) return SendClientMessage(playerid, COLOR_RED, "U?YJ /posilki [miejsce]");
new string[128];
format(string, sizeof(string), "%s wzywa posi?ki na miejsce: %s", PlayerName(playerid), p);
SendMessageToPolicja(c_Poli, string);
return true;
}

CMD:uwiez(playerid, p[]) {
if(Praca[playerid] != TEAM_POLICJA) return true;
if(isnull(p)) return SendClientMessage(playerid, COLOR_RED, "U?YJ: /uwiez [id gracza]");
if(!IsPlayerConnected(strval(p))) { new string[128]; format(string, sizeof(string), "Gracz o ID %d nie jest aktywny!", strval(p)); SendClientMessage(playerid, COLOR_RED, string); return true; }
new player = strval(p);
SetPlayerInterior(player, 3);
SetPlayerPos(player, 198.8450, 161.3695, 1003.0299);
SendClientMessage(playerid, COLOR_GREEN, "Aresztowany!");
SendClientMessage(player, COLOR_RED, "Zosta?es aresztowany, nied?ugo wyjdziesz!");
wpudle[player] = true;
return true;
}

CMD:wypusc(playerid, p[]) {
if(Praca[playerid] != TEAM_POLICJA) return true;
if(isnull(p)) return SendClientMessage(playerid, COLOR_RED, "U?YJ: /wypusc [id gracza]");
if(!IsPlayerConnected(strval(p))) { new string[128]; format(string, sizeof(string), "Gracz o ID %d nie jest aktywny!", strval(p)); SendClientMessage(playerid, COLOR_RED, string); return true; }
new player = strval(p);
SetPlayerInterior(player, 0);
SetPlayerPos(player, 2287.2163, 2428.9208, 10.8203);
SendClientMessage(playerid, COLOR_GREEN, "Uwolniony!");
wpudle[player] = false;
SendClientMessage(player, COLOR_GREEN, "Zosta?es wypuszczony!");
return true;
}

CMD:stac(playerid, p[]) {
if(Praca[playerid] != TEAM_POLICJA) return true;
if(isnull(p)) return SendClientMessage(playerid, COLOR_RED, "U?YJ: /stac [id gracza]");
if(!IsPlayerConnected(strval(p))) { new string[128]; format(string, sizeof(string), "Gracz o ID %d nie jest aktywny!", strval(p)); SendClientMessage(playerid, COLOR_RED, string); return true; }
new player = strval(p);
GameTextForPlayer(player, "~y~Zjedz na pobocze!", 20000, 5);
return true;
}


Ostatnio zmieniony przez IgrexolonO 2015-02-13, 16:49, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-13, 16:46


Pimpek2







Wiek: 29
Na forum: 4134 dni
Posty: 82
Nick w MP: ElPablo

Piwa: 1

Respekt: 60

dobra ale jest pewien problem:
mianowicie:

chce zeby gdy wpisze samo
/posilki wyskoczy?o uzyj /posilki [miejsce]

Gdy wpisze samo
/uwiez to zeby wyskoczy?o /uwiez [id gracza] Bo teraz aktualnie to jak wpisze samo /uwiez to zamyka id 0...
Tak samo z /wypusc i /stac


Zg?ry dzi?kuj? za pomoc

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-13, 16:48


IgrexolonO







Wiek: 34
Na forum: 6809 dni
Posty: 1386

Piwa: 1062

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

true, strlen *****? si? z zcmd, dodaj t? funkcje gdzie? do mapy [o ile jej nie masz]:

#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif

i skopiuj za chwile tamte komendy jak je przerobie ^

[ Dodano: 2015-02-13, 16:50 ]
yup, zrobione

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-13, 17:09


Pimpek2







Wiek: 29
Na forum: 4134 dni
Posty: 82
Nick w MP: ElPablo

Piwa: 1

Respekt: 60

Oooo dzi?ki :)

zosta?a ju? tylko ta komenda:

http://pastebin.com/1xy3qzTJ

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-13, 17:18


IgrexolonO







Wiek: 34
Na forum: 6809 dni
Posty: 1386

Piwa: 1062

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

Mam nadzieje, ?e masz sscanfa

Kod:

CMD:mandat(playerid, p[]) {
if(Praca[playerid] != TEAM_POLICJA) return true;
if(isnull(p)) return SendClientMessage(playerid, COLOR_GREY, "/mandat [ID gracza] [suma]");
new player, quantity;
sscanf(p, "ud", player, quantity);
if(player == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ADMIN, "Wybrany gracz nie g?ruje na serwerze.");
if(quantity < 1 || quantity > 100000) return SendClientMessage(playerid, COLOR_ADMIN, "Z?a waluta.");
new string[128];
format(string, sizeof(string), "Policjant %s (id:%d) dal mandat w wysokosci %d$ graczowi %s (id: %d)", PlayerName(playerid), playerid, quantity, PlayerName(player), player);
format(string, sizeof(string), "Da?e? %s (id:%d) mandat w wysoko?ci %d$", PlayerName(player), player, quantity);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "Policjant %s da? ci kar? mandatow? w wysoko?ci %d$", PlayerName(playerid), quantity);
SendClientMessage(player, COLOR_GREEN, string);
GivePlayerMoney(player, -quantity);
return true;
}


Kod:

CMD:ulecz(playerid, p[]) {
if(Praca[playerid] != TEAM_MEDYK) return true;
if(isnull(p)) return SendClientMessage(playerid, COLOR_WHITE, "Wpisz /ulecz [id gracza]");
new player;
sscanf(p, "u", player);
if(player == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Gracz o podanym ID nie widnieje na serwerze.");
SetPlayerHealth(player, 100.0);
new string[128];
format(string, sizeof(string), "Zosta?e? uleczony przez medyka: %s", PlayerName(playerid));
SendClientMessage(player, COLOR_RED, string);
format(string, sizeof(string), "Uleczy?e? gracza %s", PlayerName(player));
SendClientMessage(playerid, COLOR_RED, string);
return true;
}


Ostatnio zmieniony przez IgrexolonO 2015-02-13, 19:02, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-13, 17:32


Pimpek2







Wiek: 29
Na forum: 4134 dni
Posty: 82
Nick w MP: ElPablo

Piwa: 1

Respekt: 60

niby wszystko ok ale jak wpisze /mandat 0

to daje graczowi mandat w wysokosci 0 a chcia?bym zeby wyskakiwa?o:
/mandat [ID gracza] [suma]


i zeby mandat minimum wynosi? 1$ a maximum 100000$

z g?ry dzi?ki ;) ) jescze znalaz?em jedn? komend? do poprawy:
http://pastebin.com/2G5ebP20

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-02-13, 17:48


Intern







Wiek: 30
Na forum: 4184 dni
Posty: 40
Nick w MP: Intern

Piwa: 15

Respekt: 80

Powinno by? OK:
Kod:

CMD:mandat(playerid, p[])
{
if(Praca[playerid] == TEAM_POLICJA)
{
new player, quantity;
if(sscanf(cmdtext,"ud",player, quantity))
{
SendClientMessage(playerid, COLOR_WHITE, "Wpisz /ulecz [id gracza] [mandat]");
return 1;
}

if(player == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_RED, "Gracz o podanym ID nie jest zalogowany.");
return 1;
}

if(quantity < 1 || quantity > 100000)
{
SendClientMessage(playerid, COLOR_ADMIN, "Z?a waluta. Podaj warto?? od 1 do 100000 $.");
return 1;
}

new string[128];
format(string, sizeof(string), "Policjant %s (id:%d) dal mandat w wysokosci %d$ graczowi %s (id: %d)", PlayerName(playerid), playerid, quantity, PlayerName(player), player);
format(string, sizeof(string), "Da?e? %s (id:%d) mandat w wysoko?ci %d$", PlayerName(player), player, quantity);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "Policjant %s da? ci kar? mandatow? w wysoko?ci %d$", PlayerName(playerid), quantity);
SendClientMessage(player, COLOR_GREEN, string);
GivePlayerMoney(player, -quantity);
}
return 1;
}


Kod:

CMD:ulecz(playerid, cmdtext[])
{
if(Praca[playerid] == TEAM_MEDYK)
{
new gracz;
if(sscanf(cmdtext,"u",gracz))
{
SendClientMessage(playerid, COLOR_WHITE, "Wpisz /ulecz [id gracza]");
return 1;
}
if(!IsPlayerConnected(gracz))
{
SendClientMessage(playerid, COLOR_RED, "Gracz o podanym ID nie jest zalogowany.");
return 1;
}
SetPlayerHealth(gracz, 100);
new tmp[128];
format(tmp, sizeof(tmp), "Uleczy?e? gracza %s", PlayerName(gracz));
SendClientMessage(playerid, COLOR_RED, tmp);
format(tmp, sizeof(tmp), "Zosta?e? uleczony przez medyka: %s",PlayerName(playerid));
SendClientMessage(gracz, COLOR_RED, tmp);
}
return 1;
}


Postaw piwo autorowi tego posta
 

 
Tagi: problemy :: zcmd :: przejsciu :: strcmp
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » PAWN 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