Can I Get Some Help With a Money Command?
#1

Can somebody possibly make a command so when somebody types:

/secretcommand it will give them $5000 and you can't use it for another 30 minutes? This is what I have so far.


Код:
if(strcmp(cmdtext, "/secretcommand", true) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "You've Found The Secret Money Command! Here is $5000. Congrats!");
That goes under OnPlayerCommandText if possible?
Reply
#2

Код:
#include <a_samp>

#if defined FILTERSCRIPT

new spamblocker[MAX_PLAYERS];
forward SpamBlocker(playerid);

#endif

public OnGameModeInit()
{

	SetTimer("SpamBlocker",1800000, 1);// 30 minutes
	return 1;
}

public OnPlayerConnect(playerid)
{
  spamblocker[playerid] = 0;
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/secretcommand", true) == 0)
	{
    if(spamblocker4[playerid] == 1 ) return SendClientMessage(playerid ,0xFF0000FF, "You must w8 30 mins to use this command again!");
    {
		GivePlayerMoney(playerid, 5000);
		SendClientMessage(playerid, 0xFFFFFFFF, "You've Found The Secret Money Command! Here is $5000. Congrats!");
		spamblocker[playerid] = 1;
		return 1;
	}
	return 0;
}
public SpamBlocker(playerid)
{
  spamblocker[playerid] = 0;
  return 1;
}
i made you simple SpamBlocker and command i think you will make it with puting in the mode
Reply
#3

Hehe, I'm still a newbie. Could you put it into this for me?

Код:
#include <a_samp>

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#if defined FILTERSCRIPT

	public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Test Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(299, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(29, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(28, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddStaticVehicle(556, 2039.4518,1342.4692,10.6719,181.4084, 0, 1);
	AddStaticVehicle(557, 2039.8494,1366.3408,10.6719,180.4684, 0, 1);
	AddStaticVehicle(520, 1675.4973,1634.3698,10.8203,184, 0, 1);
	AddStaticVehicle(520, 1606.3547,1634.8986,10.8203,184, 0, 1);
	AddStaticVehicle(592, 1477.5134,1666.6249,10.8125,180.9612, 0, 1);
	AddStaticVehicle(570, 207.7576,1861.9440,13.1406,272.8510, 0, 1);
	AddStaticVehicle(570, 222.3214,1857.4633,13.1169,37.8722, 0, 1);
	SetTimer("SpamBlocker",1800000, 1);// 30 minutes
	return 1;
}


public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
  new string[64], pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
  format(string,sizeof string,"%s has joined the server. Welcome!",pName);
  SendClientMessageToAll(0xFFFFFFAA,string);
  return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
  new PlayerName[MAX_PLAYER_NAME],
  string[128];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  format(string, sizeof(string), "%s has spawned.", PlayerName);
  SendClientMessageToAll(0xFFFFFFFF, string);
}

public OnPlayerDeath(playerid, killerid, reason)
{
  if(IsPlayerAdmin(playerid)) SendClientMessageToAll(0xDEEE20FF, "An admin spawned.");
  else SendClientMessageToAll(0xDEEE20FF, "A user spawned.");
  return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/shutdownmsg5", true) == 0) return SendClientMessageToAll(0xDEEE20FF, "Server ShutDown - |||5 Minutes|||");
  if(strcmp(cmdtext, "/serverstats", true) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Current Server Version:  |v0.1| Last Update: Saturday, March 20th, 2010|");
	if(strcmp(cmdtext, "/help", true) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Chat CMDS: NONE ||| Info CMDS: /serverstats");
	if(strcmp(cmdtext, "/youshouldvisitrp", true) == 0) return SendClientMessageToAll(0xDEEE20FF, "You should visit (SITE)");
	if(strcmp(cmdtext, "/shutdownmsg1", true) == 0) return SendClientMessageToAll(0xDEEE20FF, "Server Shutdown - |||1 Minute(s)|||");
	if(strcmp(cmdtext, "/secretcommand", true) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "You've Found The Secret Money Command! Here is $5000. Congrats!");
  return false;

}

public OnPlayerInfoChange(playerid)
{
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  new string[128];
  format(string, sizeof(string), "You are entering vehicle %i",vehicleid);
  SendClientMessage(playerid, 0xFFFFFFFF, string);
  return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
  new string[128];
  format(string, sizeof(string), "INFO: You have exited vehicle %i", vehicleid);
  SendClientMessage(playerid, 0xFFFFFFFF, string);
  return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}
Reply
#4

i dint test but it shoud work

Код:
#include <a_samp>

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

new spamblocker4[MAX_PLAYERS];
forward SpamBlocker(playerid);
#if defined FILTERSCRIPT



main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	SetTimer("SpamBlocker",1800000, 1);// 30 minutes
	SetGameModeText("Test Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(299, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(29, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(28, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddStaticVehicle(556, 2039.4518,1342.4692,10.6719,181.4084, 0, 1);
	AddStaticVehicle(557, 2039.8494,1366.3408,10.6719,180.4684, 0, 1);
	AddStaticVehicle(520, 1675.4973,1634.3698,10.8203,184, 0, 1);
	AddStaticVehicle(520, 1606.3547,1634.8986,10.8203,184, 0, 1);
	AddStaticVehicle(592, 1477.5134,1666.6249,10.8125,180.9612, 0, 1);
	AddStaticVehicle(570, 207.7576,1861.9440,13.1406,272.8510, 0, 1);
	AddStaticVehicle(570, 222.3214,1857.4633,13.1169,37.8722, 0, 1);
	SetTimer("SpamBlocker",1800000, 1);// 30 minutes
	return 1;
}


public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
  spamblocker4[playerid] = 0;
  
  new string[64], pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
  format(string,sizeof string,"%s has joined the server. Welcome!",pName);
  SendClientMessageToAll(0xFFFFFFAA,string);
  return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
  new PlayerName[MAX_PLAYER_NAME],
  string[128];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  format(string, sizeof(string), "%s has spawned.", PlayerName);
  SendClientMessageToAll(0xFFFFFFFF, string);
}

public OnPlayerDeath(playerid, killerid, reason)
{
  if(IsPlayerAdmin(playerid)) SendClientMessageToAll(0xDEEE20FF, "An admin spawned.");
  else SendClientMessageToAll(0xDEEE20FF, "A user spawned.");
  return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/secretcommand", true) == 0)
	{
    if(spamblocker4[playerid] == 1 ) return SendClientMessage(playerid ,0xFF0000FF, "You must w8 30 mins to use this command again!");
    {
		GivePlayerMoney(playerid, 5000);
		SendClientMessage(playerid, 0xFFFFFFFF, "You've Found The Secret Money Command! Here is $5000. Congrats!");
		spamblocker4[playerid] = 1;
				return 1;
	}
  if(strcmp(cmdtext, "/shutdownmsg5", true) == 0) return SendClientMessageToAll(0xDEEE20FF, "Server ShutDown - |||5 Minutes|||");
  if(strcmp(cmdtext, "/serverstats", true) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Current Server Version:  |v0.1| Last Update: Saturday, March 20th, 2010|");
	if(strcmp(cmdtext, "/help", true) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Chat CMDS: NONE ||| Info CMDS: /serverstats");
	if(strcmp(cmdtext, "/youshouldvisitrp", true) == 0) return SendClientMessageToAll(0xDEEE20FF, "You should visit (SITE)");
	if(strcmp(cmdtext, "/shutdownmsg1", true) == 0) return SendClientMessageToAll(0xDEEE20FF, "Server Shutdown - |||1 Minute(s)|||");
	if(strcmp(cmdtext, "/secretcommand", true) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "You've Found The Secret Money Command! Here is $5000. Congrats!");
  return false;

}

public OnPlayerInfoChange(playerid)
{
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  new string[128];
  format(string, sizeof(string), "You are entering vehicle %i",vehicleid);
  SendClientMessage(playerid, 0xFFFFFFFF, string);
  return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
  new string[128];
  format(string, sizeof(string), "INFO: You have exited vehicle %i", vehicleid);
  SendClientMessage(playerid, 0xFFFFFFFF, string);
  return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}
public SpamBlocker(playerid)
{
  spamblocker4[playerid] = 0;
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)