GivePlayerMoney -
saffierr - 02.04.2015
Somehow it doesn't give the player cash,
When I type /givemoney 0 500, I get a message displayed "An admin gave you $" It doesn't show the amount of money nor does it gives the player money.
Code:
PHP код:
CMD:givemoney(playerid, params[])
{
new targetplayer, amount;
if(IsPlayerAdmin(playerid))
{
if(sscanf(params, "ui", targetplayer, amount))
return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /givemoney [ID] [AMOUNT]");
if(!IsPlayerConnected(targetplayer)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!");
new string[100];
GivePlayerMoney(targetplayer, amount);
format(string, sizeof string, "An admin gave you $%i", amount);
SendClientMessage(playerid, COLOR_GREEN, string);
}
else
{
SendClientMessage(playerid, -1, "SERVER: Unknown command.");
}
return 1;
}
Re: GivePlayerMoney -
Beckett - 02.04.2015
Do you have an anti-money hack system? if yes show it below.
Re: GivePlayerMoney -
saffierr - 02.04.2015
No, I just script this and that, not a server.
I want to be experienced first, so, no I don't have a anit money hack system.
Re: GivePlayerMoney -
BleverCastard - 02.04.2015
Simple anti cheat.
pawn Код:
ResetMoney(playerid)
{
if(PlayerInfo[playerid][Cash] != GetPlayerMoney(playerid))
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
}
return 1;
}
And then when you purchase something:
PlayerInfo[playerid][Money] -= (+=) 500;
ResetMonet(playerid);
Re: GivePlayerMoney -
saffierr - 02.04.2015
I am not interested in an anti money cheat system, but thank you.
I just want this code to be fixed lol.
All thoughts/replies, are appreciated.
Re: GivePlayerMoney -
saffierr - 02.04.2015
So... What's wrong with the code?
Re: GivePlayerMoney -
Crayder - 02.04.2015
Stop bumping your threads that soon, you're supposed to wait 24 hours.
This is not related to the issue, but why are you doing this? Returning 0 does this by default.
Код:
else
{
SendClientMessage(playerid, -1, "SERVER: Unknown command.");
}
Just do
Код:
if(!IsPlayerAdmin(playerid)) return 0;
Now, with the code. If you didn't script the base yourself it probably has an anticheat already that you do not know of. Or possibly any AC includes? As for the "An admin gave you $" problem, that all looks right.
Re: GivePlayerMoney -
saffierr - 02.04.2015
Oh god, dont be stupid please.
I JUST SCRIPTED THIS CODE, NOTHING MORE NOTHING LESS.
How can I fix my code?
Re: GivePlayerMoney -
willsuckformoney - 03.04.2015
Try this.
PHP код:
CMD:givemoney(playerid, params[])
{
new targetplayer, amount;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "SERVER: Unknown command.");
if(sscanf(params, "dd", targetplayer, amount)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /givemoney [ID] [AMOUNT]");
if(!IsPlayerConnected(targetplayer)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!");
new string[100];
GivePlayerMoney(targetplayer, amount);
format(string, sizeof(string), "An admin gave you $%d", amount);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
Re: GivePlayerMoney -
[ABK]Antonio - 03.04.2015
Quote:
Originally Posted by saffierr
Oh god, dont be stupid please.
I JUST SCRIPTED THIS CODE, NOTHING MORE NOTHING LESS.
How can I fix my code?
|
The SendClientMessage is on playerid instead of the target. Also recommend using the r or u specifier instead of i or d for player targeting. That way they can type part of the players name or id instead of just id