Wysłany: 2012-02-27, 11:34
Bartek23071993
WiceWersa
Wiek: 29 Na forum: 5223 dni Posty: 250
Nick w MP: WiceWersa
Piwa : 2429
Znalaz?em na tym forum komende na oddawanie exp w mapie PP. Jednak ma ona b??d, gracz mo?e oddawa? swoje exp w niesko?czono?? ..... np ma 40exp i mo?e tyle odda? ?e b?dzie mia? -100exp. Jak zrobi? ?eby m?g? odda? tyle exp ile ma i nie przekracza? "0" ?
Kod: To ten kod
COMMAND:oddajexp(playerid, params[])
{
new PlayerId, nExp;
if(sscanf(params, "ud", PlayerId, nExp))
{
SendClientMessage(playerid, COLOR_ERROR, " (b??d) U?yj: /oddajexp [id gracza] [respekt]");
return 1;
}
if(PlayerId == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_ERROR, " (b??d) Nie ma gracza o podanym id.");
return 1;
}
if(nExp > 0 || nExp > 1000)
{
SendClientMessage(playerid, COLOR_ERROR, " (b??d) B??dny exp.");
return 1;
}
Player[PlayerId][Exp] += nExp;
Player[PlayerId][Level] = GetPlayerLevel(PlayerId);
SavePlayer(PlayerId);
UpdatePlayerScore(PlayerId);
//odbieranie
Player[playerid][Exp] = Player[playerid][Exp]-nExp;
Player[playerid][Level] = GetPlayerLevel(playerid);
SavePlayer(playerid);
UpdatePlayerScore(playerid);
new String[255];
format(String, sizeof(String), " (info) Odda?e? %d respektu graczowi %s (%d).", nExp, Player[PlayerId][Name], PlayerId);
SendClientMessage(playerid, COLOR_GREEN, String);
format(String, sizeof(String), " (info) Gracz %s (%d) odda? Ci %d respektu.", Player[playerid][Name], playerid, nExp);
SendClientMessage(PlayerId, COLOR_GREEN, String);
return 1;
}
Prosz? o pomoc. Postawia zimnego browarka
Wysłany: 2012-02-27, 13:58
NET366
;7
Wiek: 29 Na forum: 5756 dni Posty: 100
Nick w MP: NET366
Piwa : 1505
Kod:
if(nExp < 0 || nExp > 1000)
{
SendClientMessage(playerid, COLOR_ERROR, " (b??d) B??dny exp.");
return 1;
}
Wysłany: 2012-02-27, 22:53
Bartek23071993
WiceWersa
Wiek: 29 Na forum: 5223 dni Posty: 250
Nick w MP: WiceWersa
Piwa : 2429
Zrobi?em w ten spos?b i dalej nie dzia?a. Mog? odda? ile chce exp a? sam b?d? mia? na minusie. Czekam na dalsze porady
Wysłany: 2012-02-27, 23:06
karol170396
Wiek: 33 Na forum: 5643 dni Posty: 580
Nick w MP: Journey
Piwa : 1520
Wysłany: 2012-02-28, 10:55
Bartek23071993
WiceWersa
Wiek: 29 Na forum: 5223 dni Posty: 250
Nick w MP: WiceWersa
Piwa : 2429
Zrobi?em w ten spos?b
Kod: if(GetPlayerScore(playerid) < nExp)
{
SendClientMessage(playerid, COLOR_ERROR, " (b??d) Nie masz tyle exp.");
return 1;
}
I jeszcze co? jest nie tak Pr?bowa?em na podstawie tego kodu
Kod: if(Player[SellerId][SellHousePrice] > Player[playerid][Exp])
{
SendClientMessage(playerid, COLOR_ERROR, " (b??d) Nie masz wystarczaj?cej ilo?ci exp na kupienie tego domu.");
return 1;
}
.... lecz nie wiem jak to ma prawid?owo wygl?da?
[ Dodano : 2012-02-28, 17:45 ]
Ju? wszystko dzia?a poprawnie. Dzi?ki za pomoc.
Tagi: komenda :: oddajexp
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: