Code: Show/Hide local void Cdonate(const char *tc, const char *params, Player *p, const Target *target) { if (target->type != T_PLAYER || params == NULL) { chat->SendMessage(p, "Usage: ?donate # privately to a player"); return; } else { int cost = atoi(params); if (check_pts(p, cost)) { int p_pts = stats->GetStat(p, STAT_FLAG_POINTS, INTERVAL_RESET); stats->SetStat(p, STAT_FLAG_POINTS, INTERVAL_RESET, p_pts - cost); int t_pts = stats->GetStat(target->u.p, STAT_FLAG_POINTS, INTERVAL_RESET); stats->SetStat(target->u.p, STAT_FLAG_POINTS, INTERVAL_RESET, t_pts + cost); chat->SendMessage(p, "You have donated your points"); chat->SendMessage(target->u.p, "You have received a donation"); } else { chat->SendMessage(p, "Not enough points"); return; } } } |
hellzlaker wrote: |
im not a programmer but i was learnin c++ 2 years ago and quit, so correct me if im wrong
the code u wrote else { chat->SendMessage(p, "Not enough points"); return; shouldnt it be ? else if { chat->SendMessage(p, "Not enough points"); return; |