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" ?
[code]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);
ret... |