Y_Ini + zcmd + sscanf giveplayermoney help!
#1

Hey guys, recently continued on my scripting and am working on a admin script. ATM I'm using enums for player data but don't know how to go about giving a player money. Now I have to remove money from PlayerInfo[playerid][Money] (the player who sends the money) and add it to the reciever's PlayerInfo[playerid][Money]. Pardon the way I write as I'm writing from a mobile phone. Thanx in advance.
Reply
#2

Hey guys, let me provide a bit more information.

I have a command that I want to give a given playerid money, but not by using the GivePlayerMoney(playerid, amount) code. I need the command to add money to the given player's enum I made.

In the end I need something like this.
Код:
CMD:givemoney(playerid, params[])
{
 New PlayerMessage[128], TargetMessage[128], Amount;
 If(sscanf(params, "ui", PlayerID, Amount))
 {
  SendClientMessage(playerid, COLOR_PURERED, "Usage:/givemoney [playerid\part of name][amount]");
 }
 Else
 {
  Load_Info(playerid);
  If(PlayerInfo[playerid][Wallet] >= Amount))
  {
   \\Needed code goes here but needs to look like the following.
   PlayerInfo[playerid][Money] -= Amount;
   PlayerInfo[PlayerID][Money] += Amount;
   \\etc, etc. Please note that PlayerID is connected to a stock and has the vallue of [MAX_PLAYERS]. I also have messages that send apon transaction but I need the money to be server side.
  }
 }
}
Thanx in advance.
Reply
#3

Like this ?
pawn Код:
stock GivePlayerMoneyEx(playerid, amount);
{
    PlayerInfo[playerid][Money] += amount; // or whateva, based on your enum.
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
    return 1;
}
Reply
#4

Worked like a charm thanx. Don't know why I didn't think of this myself lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)