Set Cash help - 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: Set Cash help (
/showthread.php?tid=239517)
Set Cash help -
aqu - 13.03.2011
Hello,
my admin command to set cash:
Код:
dcmd_setcash(playerid, params[])
{
new pID;
if(PlayerInfo[playerid][pAdminLevel] >= 1) {
if(sscanf(params, "us[128]", pID, params[2])) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setcash [playerid] [amount of money]");
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
ResetPlayerMoney(pID);
return SetPlayerMoney(pID,params[2]);
} else if(PlayerInfo[playerid][pAdminLevel] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not admin.");
return 1;
}
When I want to set example player with 0 id,I type /setcash 0 1000 .It should give 1000 ,but it gives only 49.
It always gives max amount 49.Any help ?
Re: Set Cash help -
xRyder - 13.03.2011
Try this:
pawn Код:
dcmd_setcash(playerid, params[])
{
new pID, cash;
if(PlayerInfo[playerid][pAdminLevel] >= 1)
{
if(sscanf(params, "ud", pID, cash)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setcash [playerid] [amount of money]");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
ResetPlayerMoney(pID);
return SetPlayerMoney(pID,cash);
}
else if(PlayerInfo[playerid][pAdminLevel] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not admin.");
return 1;
}
Haven't tested it, but it should work.
Re: Set Cash help -
ricardo178 - 13.03.2011
Use zcmd, much better.... And what admin system you use?
Re: Set Cash help -
aqu - 13.03.2011
Works,thx.
I don't want to use admin system from forums ,because there is too many admin commands.
Re: Set Cash help -
xir - 13.03.2011
aqu I see you changed the ban command alot. The online mistake in this cmd is your sscanf line.
Here are some sscanf tutorials
https://sampforum.blast.hk/showthread.php?tid=232129
https://sampforum.blast.hk/showthread.php?tid=225746
https://sampforum.blast.hk/showthread.php?tid=206237
EDIT: xRyder, this
pawn Код:
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
is better than IsPlayerConnected
Re: Set Cash help -
xRyder - 13.03.2011
Quote:
Originally Posted by xir
xRyder, this
pawn Код:
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
is better than IsPlayerConnected
|
Nope, it's not. It could be bugged (at least more that IsPlayerConnected()).
Re: Set Cash help -
xir - 13.03.2011
hmm really? I saw ****** use with his sscanf code?
Re: Set Cash help -
xRyder - 13.03.2011
Yeah, I think it's better to use IsPlayerConnected(). But if ****** used that, hmm now I'm confused too...
But still from my experience I prefer IsPlayerConnected() since I never had any problems with that...
Re: Set Cash help -
xir - 13.03.2011
try read from calgoones post and up
http://forum.sa-mp.com/showthread.ph...50#post1104150
and i dont get how it can get bugged? it should just match the id, how can it be bugged?
Re: Set Cash help -
xRyder - 13.03.2011
Hmmm, but still if you use IsPlayerConnected() and if player isn't connected it will return INVALID_PLAYER_ID so it's basically the same... :/