Author Topic: Simple /setmoney and /givemoeny command  (Read 725 times)

0 Members and 1 Guest are viewing this topic.

Offline Life

  • Banned
  • *
  • Posts: 25
  • Country: fo
  • Respect: +2/-0
  • Gender: Male
  • Best Firefighter, Worker Of The Month
    • View Profile
  • MCNR name: [L]ife
  • Discord name: [L]ife#2488
Simple /setmoney and /givemoeny command
« on: March 11, 2023, 09:13:30 am »
/setmoney and /givemoney command that anyone can use!

#include <a_samp>
#include <zcmd>
#include <sscanf2>

#define COLOR_WHITE 0xFFFFFF
#define COLOR_BLACK 0x000000
#define COLOR_RED 0xFF0000
#define COLOR_GREEN 0x00FF00
#define COLOR_BLUE 0x0000FF
#define COLOR_YELLOW 0xFFFF00
#define COLOR_ORANGE 0xFFA500
#define COLOR_PURPLE 0x800080

CMD:setmoney(playerid, params[])
{
    new money = strval(params);
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "Error: You are not connected to the server.");
    if(money < 0) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid amount.");
   
    SetPlayerMoney(playerid, money);
    SendClientMessage(playerid, COLOR_GREEN, "Success: Your money has been set to $%d.", money);
    return 1;
}

CMD:givemoney(playerid, params[])
{
    new money = strval(params);
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "Error: You are not connected to the server.");
    if(money < 0) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid amount.");
   
    GivePlayerMoney(playerid, money);
    SendClientMessage(playerid, COLOR_GREEN, "Success: You have been given $%d.", money);
    return 1;
}


If there are any errors please let me know.

KSKSKSS

Re: Simple /setmoney and /givemoeny command
« Reply #1 on: March 11, 2023, 09:17:24 am »
how do we script a simple samp server? :(

I made a lan server but I don't know how to add cmds or admins :/ pls teach

Offline Life

  • Banned
  • *
  • Posts: 25
  • Country: fo
  • Respect: +2/-0
  • Gender: Male
  • Best Firefighter, Worker Of The Month
    • View Profile
  • MCNR name: [L]ife
  • Discord name: [L]ife#2488
Re: Simple /setmoney and /givemoeny command
« Reply #2 on: March 11, 2023, 09:19:01 am »
go to the samp website download a server go to pawno and make a new pawnno file and copy and paste the code then press compile

Kepp in mind that you need 1 include and 1 plugin the plugin name is sscanf and the include name is zcmd.

KSKSKSS

Re: Simple /setmoney and /givemoeny command
« Reply #3 on: March 11, 2023, 01:43:17 pm »
:suicide:

Is there any detailed video that you can send to me ;-;

Offline xgg

  • Busta
  • *
  • Posts: 42
  • Country: pl
  • Respect: +2/-5
  • Gender: Male
    • View Profile
  • MCNR name: xgg
  • Discord name: xiggi
Re: Simple /setmoney and /givemoeny command
« Reply #4 on: March 11, 2023, 05:03:01 pm »
maybe next time simple ATM/Bank ( ͡° ͜ʖ ͡°)