#1

Hey guys, I want to do a buylevel cmd. Well, if the player has less than 15k, he shouldnt be able to buy it, cuz he still can get in minus. How do I set this, that his money wont get into minus? Just if he hasnt got 15k he cant buy
Reply
#2

Did you even TRY to do this yourself? Of course not. If you did, you would of been able to do such a simple task!

pawn Код:
if(GetPlayerMoney(playerid) < 15000) return SendClientMessage(playerid, 0xFFFFFFFF, "No fuck you and your lazy ass, go make enough coin to buy this first!"), 1;
Reply
#3

pawn Код:
if(GetPlayerMoney(playerid) < 15000) return SendClientMessage(playerid, -1, "U don't have 15k");
Reply
#4

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Did you even TRY to do this yourself? Of course not. If you did, you would of been able to do such a simple task!

pawn Код:
if(GetPlayerMoney(playerid) < 15000) return SendClientMessage(playerid, 0xFFFFFFFF, "No fuck you and your lazy ass, go make enough coin to buy this first!"), 1;
This makes me sick... Sure you might get mad cuz he didnt try it himself but you didnt think about that he maybe didnt know how to start? Insted of just rage out on him you can keep your anger to yourself and just help him...

Anyway like he said, this way you check if the player have enough money to do the command
pawn Код:
if(GetPlayerMoney(playerid) < 15000) return SendClientMessage(playerid, 0xAFAFAFAA, "You dont have enough money to levelup"), 1;
Reply
#5

Quote:
Originally Posted by NuggaN
Посмотреть сообщение
Hey guys, I want to do a buylevel cmd. Well, if the player has less than 15k, he shouldnt be able to buy it, cuz he still can get in minus. How do I set this, that his money wont get into minus? Just if he hasnt got 15k he cant buy
pawn Код:
new money = GetPlayerMoney(playerid);
if(money >= 15000)
{
/// do something here
}
else return SendClientMessage(playerid, -1, "U don't have 15k");
This way the players money wont go into the negative.
Reply
#6

Quote:
Originally Posted by Don_Cage
Посмотреть сообщение
This makes me sick...
Do you want a brown bag to throw up in, then?

This is the "scripting help" board. Not the "do this for me since I'm too lazy to figure out how on my own" board. I'm all for helping people, but when someone doesn't even try to do something on their own... it's ticks me off. How is someone supposed to learn if they don't try doing things on their own every once in awhile? I mean, learning is all about trial and error.

It's like math. You can't just be told how to do a problem and be able to do every single problem SIMILAR to the one you were shown how to do. It's trial and error, and tons of practice, that help people learn how to do things.

I'm SICK and tired of people coming to this forum and posting a new thread for every single error they encountered.
Reply
#7

Hey guys, thanks for the help!

ONE MORE QUESTION:

How can I set a command and give a player a value of money?

so players can give other players money and sell something etc.

with OCMD plx!
Reply
#8

pawn Код:
CMD:givemoney(playerid, params[])
{
    new string[56],giveplayerid,money,pname[56];
    if(sscanf(params,"ui", giveplayerid, money)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /givemoney [playerid/name] [amount]");
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "The target player is not online!");
    GivePlayerMoney(giveplayerid, money);
    GetPlayerName(giveplayerid,pname,sizeof(pname));
    format(string, sizeof(string), "You have given $%d to %s (id: %d).",money,pname,giveplayerid);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string, sizeof(string), "You have been given $%d from %s (id: %d).", money,pname,playerid);
    return SendClientMessage(giveplayerid, COLOR_ORANGE, string);
}
think that should manage it - pretty simple but it'll also kinda inform the using player and the receiving player.

EDIT - also this is ZCMD - not sure how OCMD works with writing commands but the body is the same reguardless.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)