Givecash & Report Commands
#1

Hi guys, are you able to tell me how to make Givecash command? I tried to copy the one from Ventura DM~MG gamemode, but didn't work. Please help...

//Edit: If possible, i also want to know how to make /report id reason command

Thanks
Puzi
Reply
#2

take out ladmin or somethink
Reply
#3

Well, how? i have one admin script, it has amx only :/ Plz help me another way if possible
Reply
#4

Hey please help!!
Reply
#5

Quote:
Originally Posted by Puzi
Hi guys, are you able to tell me how to make Givecash command? I tried to copy the one from Ventura DM~MG gamemode, but didn't work. Please help...

//Edit: If possible, i also want to know how to make /report id reason command

Thanks
Puzi
This is my givecash command it is defined as 2 /givecash then the shorter /gc:

In OnPlayerCommandText:
Код:
dcmd(givecash, 8, cmdtext);
dcmd(gc, 2, cmdtext);
Under OnPlayerCommandText:
Код:
dcmd_givecash(playerid, params[])
{
	new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	new targetid = strval(tmp);
	new NewMoney = strval(tmp2);
	if (!Player[playerid][HasSpawnedYet])
	{
	  SendClientMessage(playerid, RED, "You can't use that command when you're dead.");
		return 1;
	}
	if (NewMoney == 0)
  {
	  SendClientMessage(playerid, RED, "Usage: '/gc [PlayerID] [Amount]'");
    return 1;
  }
	if (NewMoney < 1 || NewMoney > 1000000)
  {
	  SendClientMessage(playerid, RED, "You can give up to a maximum $1000000, and a minimum of $1.");
    return 1;
  }
  if (!IsPlayerConnected(targetid))
  {
	  format(myString, sizeof(myString), "%i is not a valid player.", targetid);
	  SendClientMessage(playerid, RED, myString);
    return 1;
	}
  GetPlayerName(playerid, playerName, sizeof(playerName));
  GetPlayerName(targetid, targetName, sizeof(targetName));
  if (GetPlayerMoney(playerid) < NewMoney)
  {
	  format(myString, sizeof(myString), "You can't afford to give $%i to %s (%i).", NewMoney, targetName, targetid);
	  SendClientMessage(playerid, RED, myString);
    return 1;
  }
  GivePlayerMoney(playerid, -NewMoney);
	GivePlayerMoney(targetid, NewMoney);
	format(myString, sizeof(myString), "You have given $%i to %s (%i).", NewMoney, targetName, targetid);
	SendClientMessage(playerid, GREEN, myString);
	format(myString, sizeof(myString), "%s (%i) has given you $%i.", playerName, playerid, NewMoney);
	SendClientMessage(targetid, GREEN, myString);

  dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
  dUserSetINT(PlayerName(targetid)).("money",GetPlayerMoney(targetid));

	Player[playerid][TypedSpawn] = true;
	return 1;
}

dcmd_gc(playerid, params[])
{
	new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	new targetid = strval(tmp);
	new NewMoney = strval(tmp2);
	if (!Player[playerid][HasSpawnedYet])
	{
	  SendClientMessage(playerid, RED, "You can't use that command when you're dead.");
		return 1;
	}
	if (playerid == targetid)
  {
	  SendClientMessage(playerid, RED, "You can't give money to yourself.");
    return 1;
  }
	if (NewMoney == 0)
  {
	  SendClientMessage(playerid, RED, "Usage: '/gc [PlayerID] [Amount]'");
    return 1;
  }
	if (NewMoney < 1 || NewMoney > 1000000)
  {
	  SendClientMessage(playerid, RED, "You can give up to a maximum $1000000, and a minimum of $1.");
    return 1;
  }
  if (!IsPlayerConnected(targetid))
  {
	  format(myString, sizeof(myString), "%i is not a valid player.", targetid);
	  SendClientMessage(playerid, RED, myString);
    return 1;
	}
  GetPlayerName(playerid, playerName, sizeof(playerName));
  GetPlayerName(targetid, targetName, sizeof(targetName));
  if (GetPlayerMoney(playerid) < NewMoney)
  {
	  format(myString, sizeof(myString), "You can't afford to give $%i to %s (%i).", NewMoney, targetName, targetid);
	  SendClientMessage(playerid, RED, myString);
    return 1;
  }
  GivePlayerMoney(playerid, -NewMoney);
	GivePlayerMoney(targetid, NewMoney);
	format(myString, sizeof(myString), "You have given $%i to %s (%i).", NewMoney, targetName, targetid);
	SendClientMessage(playerid, GREEN, myString);
	format(myString, sizeof(myString), "%s (%i) has given you $%i.", playerName, playerid, NewMoney);
	SendClientMessage(targetid, GREEN, myString);

  dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
  dUserSetINT(PlayerName(targetid)).("money",GetPlayerMoney(targetid));

	Player[playerid][TypedSpawn] = true;
	return 1;
}
I am not sure about the report command tho so sorry for that but I hope this helps!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)