ResetPlayerMoney - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ResetPlayerMoney (
/showthread.php?tid=252032)
ResetPlayerMoney -
DaRealz - 29.04.2011
Hello, i am new to the community and i am beggining to script.
I am tryign to make a command to reset someones money, like /resetmoney [playerid]
This is what i came up with but it will not work.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(IsPlayerAdmin(playerid))
{
if(!strcmp(cmdtext, "/resetmoney", true))
{
ResetPlayerMoney(playerid);
SendClientMessage(playerid, COLOR_NORMAL_PLAYER, "An admin has reset your money.");
print("You have set this players money.");
return 1
}
PS:
pawn Код:
#define COLOR_NORMAL_PLAYER 0xFF4444FF
This is in the script.
Sorry for my newbieness...
/DaRealz
Re: ResetPlayerMoney -
admantis - 29.04.2011
Well.. first of all, you will need to be admin to use -every- command.
Second, you missing a bracket.
And third,
playerid is the player who performs the command. To perform commands on other players use sscanf.
Why you don't learn the basics before making an admin system!?
Re: ResetPlayerMoney - [L3th4l] - 29.04.2011
If you are beginning to script, I don't recommend starting with the old method of doing commands. Search for "zcmd", download it ( follow install instructions on that same thread ).
Now, once you got that file ready to use. We can do our commands faster than ever:
pawn Код:
#include <a_samp>
#include <zcmd>
// Rest of code
CMD:resetcash(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /ResetCash < Player ID >");
new
ToPlayer = strval(params);
if(!IsPlayerConnected(ToPlayer)) return SendClientMessage(playerid, COLOR_RED, "That user is not connected!");
ResetPlayerMoney(ToPlayer);
SendClientMessage(ToPlayer, COLOR_RED, "An admin has removed your cash!");
return 1;
}
// Rest of code
That's way easier than the method you are doing.