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

Wysłany: 2013-04-18, 20:03


bali15







Wiek: 30
Na forum: 4880 dni
Posty: 123

Piwa: 1

Respekt: 50

witam mam do wa? pro?b? chodzi mi ?eby?cie wys?ali mi gotowy kod z komend? /mandat bo szuka?em i niemoge znale??dzia?aj?cej ;/

Postaw piwo autorowi tego posta
 

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


naimad424

Damian






Wiek: 28
Na forum: 4915 dni
Posty: 357

Piwa: 3508

Respekt: 360
Respekt: 360Respekt: 360Respekt: 360Respekt: 360

Mandat
Kod:


if (strcmp(cmd, "/mandat", true)==0) {
if(gTeam[playerid] == TEAM_POLICJA){
new moneyplayer;
new moneyplus;
mpt = strtok(cmdtext, idx);
if(!strlen(mpt)) {
SendClientMessage(playerid, COLOR_GREY, "/mandat [ID gracza] [suma]");
} else {
moneyplayer = strval(mpt);
mpt = strtok(cmdtext, idx);
if(!strlen(mpt)) {
SendClientMessage(playerid, COLOR_ADMIN, "Z?a waluta");
} else {
moneyplus = strval(mpt);
new moneyplayername[MAX_PLAYER_NAME];
GetPlayerName(moneyplayer,moneyplayername,sizeof(moneyplayername));
format(string, sizeof(string), "Policjant %s (id:%d) dal mandat w wysokosci %d$ graczowi %s (id: %d)",PlayerName(playerid),playerid, moneyplus, moneyplayername,giveplayerid);
printf(string);
format(string, sizeof(string), "Da?e? %d$ graczowi mandat w wysoko?ci %s $",moneyplus, moneyplayername);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "Policjant %s da? ci kar? mandatow? w wysoko?ci %d$",PlayerName(playerid),moneyplus);
SendClientMessage(moneyplayer, COLOR_GREEN, string);
GivePlayerMoney(moneyplayer, -moneyplus);
}
}
}
return 1;
}


Punkty karne
Kod:


if(strcmp(cmd, "/pkt", true)==0 && gTeam[playerid] == TEAM_POLICJA)
{
new scoreplayer;
new scoreplus;
mpt = strtok(cmdtext, idx);
if(!strlen(mpt)) {
GameTextForPlayer(playerid,"~w~Uzyj: ~y~/pkt ~g~ID Gracza ~r~Punkty",2000,5);
} else {
scoreplayer = strval(mpt);
mpt = strtok(cmdtext, idx);
if(!strlen(mpt)) {
SendClientMessage(playerid, COLOR_ADMIN, "Z?a ilo??");
} else {
scoreplus = strval(mpt);
new moneyplayername[MAX_PLAYER_NAME];
GetPlayerName(scoreplayer,moneyplayername,sizeof(moneyplayername));
format(string, sizeof(string), "Policjant %s (id:%d) dal %d punkt?w karnych graczowi %s (id: %d)",PlayerName(playerid),playerid, scoreplus, moneyplayername,giveplayerid);
printf(string);
format(string, sizeof(string), "Da?e? %d punkt?w karnych graczowi %s",scoreplus, moneyplayername);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "Policjant %s da? Ci %d punkt?w karnych",PlayerName(playerid),scoreplus);
SendClientMessage(scoreplayer, COLOR_GREEN, string);
SetPlayerScore(scoreplayer, GetPlayerScore(scoreplayer) -scoreplus);
}
}
return 1;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-18, 20:18


bali15







Wiek: 30
Na forum: 4880 dni
Posty: 123

Piwa: 1

Respekt: 50

naimad424, a konketnie na zcmd ? ;/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-18, 20:23


naimad424

Damian






Wiek: 28
Na forum: 4915 dni
Posty: 357

Piwa: 3508

Respekt: 360
Respekt: 360Respekt: 360Respekt: 360Respekt: 360

Kod:


if (zcmd(cmd, "/mandat", true)==0) {
if(gTeam[playerid] == TEAM_POLICJA){
new moneyplayer;
new moneyplus;
mpt = strtok(cmdtext, idx);
if(!strlen(mpt)) {
SendClientMessage(playerid, COLOR_GREY, "/mandat [ID gracza] [suma]");
} else {
moneyplayer = strval(mpt);
mpt = strtok(cmdtext, idx);
if(!strlen(mpt)) {
SendClientMessage(playerid, COLOR_ADMIN, "Z?a waluta");
} else {
moneyplus = strval(mpt);
new moneyplayername[MAX_PLAYER_NAME];
GetPlayerName(moneyplayer,moneyplayername,sizeof(moneyplayername));
format(string, sizeof(string), "Policjant %s (id:%d) dal mandat w wysokosci %d$ graczowi %s (id: %d)",PlayerName(playerid),playerid, moneyplus, moneyplayername,giveplayerid);
printf(string);
format(string, sizeof(string), "Da?e? %d$ graczowi mandat w wysoko?ci %s $",moneyplus, moneyplayername);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "Policjant %s da? ci kar? mandatow? w wysoko?ci %d$",PlayerName(playerid),moneyplus);
SendClientMessage(moneyplayer, COLOR_GREEN, string);
GivePlayerMoney(moneyplayer, -moneyplus);
}
}
}
return 1;
}


To powinno zadzia?a?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-18, 20:26


bali15







Wiek: 30
Na forum: 4880 dni
Posty: 123

Piwa: 1

Respekt: 50

naimad424, a nie powinno sie zaczyna? od: CMD:mandat(playerid, params[] ??


;/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-18, 20:31


naimad424

Damian






Wiek: 28
Na forum: 4915 dni
Posty: 357

Piwa: 3508

Respekt: 360
Respekt: 360Respekt: 360Respekt: 360Respekt: 360

bali15, mo?na zapisa? to w r??nych sposobach,

dzisiaj przez noc b?d? pisa? systemy dom?w i prywatnych aut pod zcmd to i system /mandat napisze , jutro dam kod , chyba ?e kto? mnie uprzedzi :)

Ale pr?buj te co ci da?em

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-18, 20:36


bali15







Wiek: 30
Na forum: 4880 dni
Posty: 123

Piwa: 1

Respekt: 50

naimad424, Ok b?de prubowa? , a jak co? to poczekam do jutra :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-18, 20:38


Wafelowski







Wiek: 29
Na forum: 5347 dni
Posty: 428

Piwa: 100

Respekt: 232
Respekt: 232Respekt: 232

Kod:


CMD:mandatadaj(playerid, params[])
{
if(GetPlayerTeam(playerid) != TEAM_POLICJA)
return SendClientMessage(playerid, -1, "Nie nale?ysz do policji");

new mandatid, amount, reason[24];
if(sscanf(parmas, "dds[24]", mandatid, amount, reason))
return SendClientMessage(playerid, -1, "U?ycie: /mandatadaj [ID Gracza] [Suma] [Pow?d]");

if(!IsPlayerConnected(mandatid))
return SendClientMessage(playerid, -1, "Ten gracz nie jest pod??czony.");

if(strval(amount) < 100 || strval(amount) > 10000)
return SendClientMessage(playerid, -1, "Suma mandatu nie mo?e by? mniejsza od 100$ i wi?ksza od 10 000$");

if(reason < 3 || reason < 23)
return SendClientMessage(playerid, -1, "Pow?d nie mo?e by? mniejszy od 3 i wi?kszy od 23 znakuf");

if(GetPlayerMoney(mandatid) < strval(amount))
return SendClientMessage(playerid, -1, "Ten gracz nie ma tyle got?wki.");

new str[128];
format(str, sizeof(str), "Otrzyma?e? $%d mandatu od %s (%d) Pow?d: %s", amount, PlayerName(playerid), playerid, reason);
SendClientMessage(mandatid, -1, str);

format(str, sizeof(str), "Wystai?e? $%d mandatu graczu %s (%d) z powodem: %s", amount, PlayerName(mandatid), mandatid, reason);
SendClientMessage(playerid, -1, str);

GivePlayerMoney(mandatid, -amount);
GivePlayerMoney(playerid, amount);
return 1;
}
Ale mi filozofia... Zaj??o mi to 3 minuty.

@EDIT: Poprawi?em nieco kod...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-18, 20:54


bali15







Wiek: 30
Na forum: 4880 dni
Posty: 123

Piwa: 1

Respekt: 50

(1576) : error 035: argument type mismatch (argument 1)
(1573) : error 033: array must be indexed (variable "reason")
(1570) : error 035: argument type mismatch (argument 1)

LINIJKA:

1576:
if(strval(amount) < 100 || strval(amount) > 10000)

1573:
if(reason < 3 || reason < 23)
1570:
if(strval(amount) < 100 || strval(amount) > 10000)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-18, 20:58


Wafelowski







Wiek: 29
Na forum: 5347 dni
Posty: 428

Piwa: 100

Respekt: 232
Respekt: 232Respekt: 232

Poprawiony kod, liter?wka i inne pierdo?y o kt?rych zapomnia?em. ;)

Kod:


CMD:mandatadaj(playerid, params[])
{
if(GetPlayerTeam(playerid) != TEAM_POLICJA)
return SendClientMessage(playerid, -1, "Nie nale?ysz do policji");

new mandatid, amount, reason[24];
if(sscanf(params, "dds[24]", mandatid, amount, reason))
return SendClientMessage(playerid, -1, "U?ycie: /mandatadaj [ID Gracza] [Suma] [Pow?d]");

if(!IsPlayerConnected(mandatid))
return SendClientMessage(playerid, -1, "Ten gracz nie jest pod??czony.");

if(amount < 100 || amount > 10000)
return SendClientMessage(playerid, -1, "Suma mandatu nie mo?e by? mniejsza od 100$ i wi?ksza od 10 000$");

if(strlen(reason) < 3 || strlen(reason) < 23)
return SendClientMessage(playerid, -1, "Pow?d nie mo?e by? mniejszy od 3 i wi?kszy od 23 znakuf");

if(GetPlayerMoney(mandatid) < amount)
return SendClientMessage(playerid, -1, "Ten gracz nie ma tyle got?wki.");

new str[128];
format(str, sizeof(str), "Otrzyma?e? $%d mandatu od %s (%d) Pow?d: %s", amount, PlayerName(playerid), playerid, reason);
SendClientMessage(mandatid, -1, str);

format(str, sizeof(str), "Wystai?e? $%d mandatu graczu %s (%d) z powodem: %s", amount, PlayerName(mandatid), mandatid, reason);
SendClientMessage(playerid, -1, str);

GivePlayerMoney(mandatid, -amount);
GivePlayerMoney(playerid, amount);
return 1;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-19, 19:41


bali15







Wiek: 30
Na forum: 4880 dni
Posty: 123

Piwa: 1

Respekt: 50

Wafelowski, Niedzia?a w dalszym ci?gu ;/ pokazuje sie tylko to :

U?ycie: /mandatadaj [ID Gracza] [Suma] [Pow?d]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-19, 19:55


Wafelowski







Wiek: 29
Na forum: 5347 dni
Posty: 428

Piwa: 100

Respekt: 232
Respekt: 232Respekt: 232

Zaktualizuj sscanf'a:
http://gtao.pl.com/showthread.php?t=120356

... albo zamie? ten kod sscanf'a na ten:

Kod:


if(!sscanf(params, "dds[24]", mandatid, amount, reason))
return SendClientMessage(playerid, -1, "U?ycie: /mandatadaj [ID Gracza] [Suma] [Pow?d]");


Postaw piwo autorowi tego posta
 

 
Tagi: /mandt :: zcmd
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] /mandt zcmd 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