Quote:
Originally Posted by AndySedeyn
Why are you promoting the use of even more deprecated, outdated and inefficient functions than OnPlayerCommandText? Sure, it's good to know about them, but the use of them should be avoided at all times!
Use this:
PHP код:
public OnPlayerCommandText(playerid, cmdtext[]) {
if(!strcmp(cmdtext, "transfer", true)) {
new
id,
amount,
cash;
if(sscanf(params,"ui", id, amount))
return SendClientMessage(playerid, 0xCECECEFF, "CMD: /transfer [player] [amount]");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, 0xCECECEFF, "Player is not connected");
cash = GetPlayerMoney(playerid);
if(amount > cash)
return SendClientMessage(playerid, 0xCECECEFF, "You do not have that much!");
if(amount < 1)
return SendClientMessage(playerid, 0xCECECEFF, "You can not transfer funds under 1!");
GivePlayerMoney(playerid, -amount);
GivePlayerMoney(id, amount);
SendClientMessage(playerid, 0xCECECEFF, "You sent the money.");
SendClientMessage(id, 0xCECECEFF, "You got given money.");
return 1;
}
return 0;
}
|
If you would have read what his topic said, you would have know why I used that
I even said on my comment that he shouldn't use them:
Just to let you know, ZCMD is faster than strcmp.
So please open your eyes before posting something.