Пример #1
0
// forward OnServerSendRPC(player_id, rpc_id, BitStream:bs);
bool Callbacks::OnServerSendRPC(int player_id, int rpc_id, RakNet::BitStream *bs)
{
	cell retval{};

	auto &AMXs = Callbacks::GetAmxMap();

	for (auto &i : AMXs)
	{
		auto amx = i.first;
		const auto &public_data = i.second._public_on_server_send_rpc;

		if (public_data.exists)
		{
			if (bs)
				bs->ResetReadPointer();

			amx_Push(amx, reinterpret_cast<cell>(bs));
			amx_Push(amx, static_cast<cell>(rpc_id));
			amx_Push(amx, static_cast<cell>(player_id));

			amx_Exec(amx, &retval, public_data.id);

			if (retval == 0)
				return false;
		}
	}

	return true;
}
Пример #2
0
// forward OnQueryError(connectionId, query[], callback[], errno, error[]);
int Script::OnQueryError(unsigned int connectionId, const char* query, const char* callback, int error_number, const char* error) {
	if (OnQueryError_index_ == CallbackNotFoundIndex)
		return 0;

	// Attempt to find the OnQueryError callback in the script.
	if (OnQueryError_index_ == 0) {
		if (amx_FindPublic(runtime_, "OnQueryError", &OnQueryError_index_) != AMX_ERR_NONE) {
			OnQueryError_index_ = CallbackNotFoundIndex;
			return 0;
		}
	}

	cell returnValue, stringCell[3], *physicalCell;

	// Push the arguments to OnQueryError in reverse order.
	amx_PushString(runtime_, &stringCell[0], &physicalCell, error, 0, 0);
	amx_Push(runtime_, error_number);
	amx_PushString(runtime_, &stringCell[1], &physicalCell, callback, 0, 0);
	amx_PushString(runtime_, &stringCell[2], &physicalCell, query, 0, 0);
	amx_Push(runtime_, connectionId);

	// Execute and get the return value.
	amx_Exec(runtime_, &returnValue, OnQueryError_index_);

	// Clean up the strings we pushed to Pawn's stack.
	amx_Release(runtime_, stringCell[0]);
	amx_Release(runtime_, stringCell[1]);
	amx_Release(runtime_, stringCell[2]);

	return returnValue;
}
Пример #3
0
AmxArgument SAMP::CallAmxFunction(const std::string& functionName, const AmxArguments& arguments)
{
    if (!ms_pAmxVM)
        return false;

    // Push arguments onto the stack
    for (const auto& argument : arguments.GetList())
    {
        switch (argument.GetType())
        {
        case eAmxArgumentType::Boolean:
            amx_Push(ms_pAmxVM, static_cast<cell>(argument.GetBool()));
            break;
        case eAmxArgumentType::Number:
            amx_Push(ms_pAmxVM, static_cast<cell>(argument.GetNumber()));
            break;
        case eAmxArgumentType::String:
            cell amx_addr, *amx_physaddr;
            amx_PushString(ms_pAmxVM, &amx_addr, &amx_physaddr, argument.GetString(), 0, 0);
            break;
        }
    }
    
    // Call function
    cell amx_return;
    amx_Exec(ms_pAmxVM, &amx_return, AMX_EXEC_MAIN);

    return AmxArgument(amx_return);
}
Пример #4
0
bool CCallbackManager::OnRemoteRCONPacket(unsigned int binaryAddress, int port, char *password, bool success, char* command)
{
	int idx = -1;
	cell ret = 1;
	for(std::vector<AMX*>::const_iterator iter = m_vecAMX.begin(); iter != m_vecAMX.end(); ++iter)
	{
		if(!amx_FindPublic(*iter, "OnRemoteRCONPacket", &idx))
		{
			cell amx_addr, *phys_addr;
			
			in_addr in;
			in.s_addr = binaryAddress;

			amx_PushString(*iter, &amx_addr, &phys_addr, command, 0, 0);
			amx_Push(*iter, static_cast<cell>(success));
			amx_PushString(*iter, &amx_addr, &phys_addr, password, 0, 0);
			amx_Push(*iter, static_cast<cell>(port));
			amx_PushString(*iter, &amx_addr, &phys_addr, inet_ntoa(in), 0, 0);
			amx_Exec(*iter, &ret, idx);
			amx_Release(*iter, amx_addr);

			if (!ret) return 0;
		}
	}
	return !!ret;
}
Пример #5
0
PLUGIN_EXPORT bool PLUGIN_CALL OnVehicleRespray(int playerid, int vehicleid, int color1, int color2)
{
	for (boost::unordered_map<int, int>::iterator i = core->getData()->internalVehicles.begin(); i != core->getData()->internalVehicles.end(); ++i)
	{
		if (i->second == vehicleid)
		{
			for (std::set<AMX*>::iterator a = core->getData()->interfaces.begin(); a != core->getData()->interfaces.end(); ++a)
			{
				int amxIndex = 0;
				if (!amx_FindPublic(*a, "OnDynamicVehicleRespray", &amxIndex))
				{
					amx_Push(*a, static_cast<cell>(color2));
					amx_Push(*a, static_cast<cell>(color1));
					amx_Push(*a, static_cast<cell>(i->first));
					amx_Push(*a, static_cast<cell>(playerid));
					amx_Exec(*a, NULL, amxIndex);
				}
			}
			boost::unordered_map<int, Item::SharedVehicle>::iterator p = core->getData()->vehicles.find(i->first);
			if (p != core->getData()->vehicles.end())
			{
				p->second->color1 = color1; 
				p->second->color2 = color2; 
			}
			break;
		}
	}
	return true;
}
Пример #6
0
PLUGIN_EXPORT bool PLUGIN_CALL OnVehicleMod(int playerid, int vehicleid, int componentid)
{
	for (boost::unordered_map<int, int>::iterator i = core->getData()->internalVehicles.begin(); i != core->getData()->internalVehicles.end(); ++i)
	{
		if (i->second == vehicleid)
		{
			for (std::set<AMX*>::iterator a = core->getData()->interfaces.begin(); a != core->getData()->interfaces.end(); ++a)
			{
				int amxIndex = 0;
				if (!amx_FindPublic(*a, "OnDynamicVehicleMod", &amxIndex))
				{
					amx_Push(*a, static_cast<cell>(componentid));
					amx_Push(*a, static_cast<cell>(i->first));
					amx_Push(*a, static_cast<cell>(playerid));
					amx_Exec(*a, NULL, amxIndex);
				}
			}
			boost::unordered_map<int, Item::SharedVehicle>::iterator p = core->getData()->vehicles.find(i->first);
			if (p != core->getData()->vehicles.end())
			{
				if (!Utility::isInContainer(p->second->carmods, componentid))
				{
					Utility::addToContainer(p->second->carmods, componentid);
				}
			}
			break;
		}
	}
	return true;
}
Пример #7
0
PLUGIN_EXPORT bool PLUGIN_CALL OnTrailerUpdate(int playerid, int vehicleid)
{
	for (boost::unordered_map<int, int>::iterator i = core->getData()->internalVehicles.begin(); i != core->getData()->internalVehicles.end(); ++i)
	{
		if (i->second == vehicleid)
		{
			for (std::set<AMX*>::iterator a = core->getData()->interfaces.begin(); a != core->getData()->interfaces.end(); ++a)
			{
				int amxIndex = 0;
				cell ret = 1;
				if (!amx_FindPublic(*a, "OnDynamicTrailerUpdate", &amxIndex))
				{
					amx_Push(*a, static_cast<cell>(i->first));
					amx_Push(*a, static_cast<cell>(playerid));
					amx_Exec(*a, &ret, amxIndex);

					if(!ret) return false;
				}
			}
			boost::unordered_map<int, Item::SharedVehicle>::iterator p = core->getData()->vehicles.find(i->first);
			if (p != core->getData()->vehicles.end())
			{		
				if (!p->second->touched)
				{
					p->second->touched = true;
					core->getStreamer()->movingVehicles.insert(p->second);
				}
				p->second->lastUpdatedTick = GetTickCount();
			}
			break;
		}
	}
	return true;
}
Пример #8
0
PLUGIN_EXPORT bool PLUGIN_CALL OnVehicleDamageStatusUpdate(int vehicleid, int playerid)
{
	for (boost::unordered_map<int, int>::iterator i = core->getData()->internalVehicles.begin(); i != core->getData()->internalVehicles.end(); ++i)
	{
		if (i->second == vehicleid)
		{
			for (std::set<AMX*>::iterator a = core->getData()->interfaces.begin(); a != core->getData()->interfaces.end(); ++a)
			{
				int amxIndex = 0;
				if (!amx_FindPublic(*a, "OnDynamicVehDamageStatusUpdate", &amxIndex))
				{
					amx_Push(*a, static_cast<cell>(playerid));
					amx_Push(*a, static_cast<cell>(i->first));
					amx_Exec(*a, NULL, amxIndex);
				}
			}
			boost::unordered_map<int, Item::SharedVehicle>::iterator p = core->getData()->vehicles.find(i->first);
			if (p != core->getData()->vehicles.end())
			{		
				/*
				if (!p->second->touched)
				{
					p->second->touched = true;
					core->getStreamer()->movingVehicles.insert(p->second);
				}
				*/
				p->second->lastUpdatedTick = GetTickCount();
				GetVehicleDamageStatus(i->first, &p->second->panels, &p->second->doors, &p->second->lights, &p->second->tires);
			}
			break;
		}
	}
	return true;
}
Пример #9
0
PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerGiveDamageActor(int playerid, int actorid, float amount, int weaponid, int bodypart)
{
	for (boost::unordered_map<int, int>::iterator i = core->getData()->internalActors.begin(); i != core->getData()->internalActors.end(); ++i)
	{
		if (i->second == actorid)
		{
			int actorid = i->first;
			for (std::set<AMX*>::iterator a = core->getData()->interfaces.begin(); a != core->getData()->interfaces.end(); ++a)
			{
				int amxIndex = 0;
				if (!amx_FindPublic(*a, "OnPlayerGiveDamageDynamicActor", &amxIndex))
				{
					amx_Push(*a, static_cast<cell>(bodypart));
					amx_Push(*a, static_cast<cell>(weaponid));
					amx_Push(*a, amx_ftoc(amount));
					amx_Push(*a, static_cast<cell>(actorid));
					amx_Push(*a, static_cast<cell>(playerid));
					amx_Exec(*a, NULL, amxIndex);
				}
			}
			break;
		}
	}
	return true;
}
Пример #10
0
// forward OnConnectionAttempt(connectionHandle, bool: succeeded, server[], username[], errno, error[]);
int Script::OnConnectionAttempt(unsigned int connectionId, bool succeeded, const char* server, const char* username, int error_number, const char* error) {
	if (OnConnectionAttempt_index_ == CallbackNotFoundIndex)
		return 0;

	// Attempt to find the OnConnectionAttempt callback in the script.
	if (OnConnectionAttempt_index_ == 0) {
		if (amx_FindPublic(runtime_, "OnConnectionAttempt", &OnConnectionAttempt_index_) != AMX_ERR_NONE) {
			OnConnectionAttempt_index_ = CallbackNotFoundIndex;
			return 0;
		}
	}

	cell returnValue, stringCell[3], *physicalCell;

	// We've now got the callback. Push the arguments in reverse order.
	amx_PushString(runtime_, &stringCell[0], &physicalCell, error, 0, 0);
	amx_Push(runtime_, error_number);
	amx_PushString(runtime_, &stringCell[1], &physicalCell, username, 0, 0);
	amx_PushString(runtime_, &stringCell[2], &physicalCell, server, 0, 0);
	amx_Push(runtime_, succeeded);
	amx_Push(runtime_, connectionId);

	// Execute and get the return value.
	amx_Exec(runtime_, &returnValue, OnConnectionAttempt_index_);

	// Clean up the strings we pushed to Pawn's stack.
	amx_Release(runtime_, stringCell[0]);
	amx_Release(runtime_, stringCell[1]);
	amx_Release(runtime_, stringCell[2]);

	return returnValue;
}
Пример #11
0
void OnVehWrecked(RPCParameters *rpcParams)
{
	if (pRakServer && pGameModeAmx)
	{
		int iPlayer;
		USHORT usVehicle;

		iPlayer = pRakServer->GetIndexFromPlayerID(rpcParams->sender);
		
		if (!IsPlayerConnectedEx(iPlayer)) return;

		RakNet::BitStream bsData(rpcParams->input, rpcParams->numberOfBitsOfData / 8, false);

		bsData.Read(usVehicle);

		if (!IsValidVehicleEx(usVehicle)) return;

		CPlayerPool *pPlayerPool = pNetGame->pPlayerPool;
		CVehicle *pVehicle = pNetGame->pVehiclePool->pVehicle[usVehicle];

		if (!pVehicle) return;

		if (!pPlayerPool->pPlayer[iPlayer]->byteVehicleStreamedIn[pVehicle->wVehicleID]) return;

		int idx;
		cell ret = 0;

		if (!amx_FindPublic(pGameModeAmx, "OnVehicleRequestDeath", &idx))
		{
			amx_Push(pGameModeAmx, iPlayer);
			amx_Push(pGameModeAmx, usVehicle);
			amx_Exec(pGameModeAmx, &ret, idx);

			if ((cell)ret)
			{
				pVehicle->bDead = true;
				pVehicle->bDeathNotification = 0;
				pVehicle->wKillerID = iPlayer;
			}

			return;
		}
		else
		{
			pVehicle->bDead = true;
			pVehicle->bDeathNotification = 0;
			pVehicle->wKillerID = iPlayer;
		}

		return;

	}
}
Пример #12
0
uint32_t CGamemodeManager::OnPlayerDisconnect(cell playerid, cell reason)
{
	int idx;
	cell ret = 0;

	if (!amx_FindPublic(&gmAMX, "OnPlayerDisconnect", &idx))
	{
		amx_Push(&gmAMX, reason);
		amx_Push(&gmAMX, playerid);
		amx_Exec(&gmAMX, &ret, idx);
	}
	return (uint32_t)ret;
}
Пример #13
0
uint32_t CGamemodeManager::OnPlayerKeyStateChange(cell playerid, cell newkeys, cell oldkeys)
{
	int idx;
	cell ret = 0;

	if (!amx_FindPublic(&gmAMX, "OnPlayerKeyStateChange", &idx))
	{
		amx_Push(&gmAMX, oldkeys);
		amx_Push(&gmAMX, newkeys);
		amx_Push(&gmAMX, playerid);
		amx_Exec(&gmAMX, &ret, idx);
	}
	return (uint32_t)ret;
}
Пример #14
0
uint32_t CGamemodeManager::OnPlayerTargetPlayer( cell playerID, cell targetID )
{
	int idx;
	cell ret = 0;

	if(!amx_FindPublic(&gmAMX, "OnPlayerTargetPlayer", &idx)) {

		amx_Push(&gmAMX, targetID );
		amx_Push(&gmAMX, playerID);
		amx_Exec(&gmAMX, &ret, idx);
	}

	return (uint32_t)ret;
}
Пример #15
0
uint32_t CGamemodeManager::OnVehicleDamageStatusUpdate(cell vehicleid, cell playerid)
{
	if (!gmIsInit) return 0;

	int idx;
	cell ret = 0;

	if(!amx_FindPublic(&gmAMX, "OnVehicleDamageStatusUpdate", &idx)) {
		amx_Push(&gmAMX, playerid);
		amx_Push(&gmAMX, vehicleid);
		amx_Exec(&gmAMX, &ret, idx);
	}

	return (uint32_t)ret;
}
Пример #16
0
uint32_t CGamemodeManager::OnPlayerPickedUpPickup(cell playerid, cell pickupid)
{
	if (!gmIsInit) return 0;

	int idx;
	cell ret = 0;

	if (!amx_FindPublic(&gmAMX, "OnPlayerPickUpPickup", &idx))
	{
		amx_Push(&gmAMX, pickupid);
		amx_Push(&gmAMX, playerid);
		amx_Exec(&gmAMX, &ret, idx);
	}
	return (uint32_t)ret;
}
Пример #17
0
uint32_t CGamemodeManager::OnVehiclePaintjob(cell playerid, cell vehicleid, cell pauint32_tjobid)
{
	if (!gmIsInit) return 0;
	int idx;
	cell ret = 1;

	if (!amx_FindPublic(&gmAMX, "OnVehiclePaintjob", &idx))
	{
		amx_Push(&gmAMX, pauint32_tjobid);
		amx_Push(&gmAMX, vehicleid);
		amx_Push(&gmAMX, playerid);
		amx_Exec(&gmAMX, &ret, idx);
	}
	return (uint32_t)ret;
}
Пример #18
0
void CNetwork::OnClientDeath(cell attacker, cell receiver) {
	CBasePlayer *pPlayer = new CBasePlayer;
	attacker = pPlayer->GetInternalIDFromNFID(attacker);
	receiver = pPlayer->GetInternalIDFromNFID(receiver);
	printf("OnClientDeath(%d, %d) has been called.\n", pPlayer->GetNFIDFromInternalID(attacker), pPlayer->GetNFIDFromInternalID(receiver));
	int idx;
	cell ret = 0;
	if (!amx_FindPublic(&inimod_amx, "OnClientDeath", &idx)) {
		amx_Push(&inimod_amx, receiver);
		amx_Push(&inimod_amx, attacker);
		amx_Exec(&inimod_amx, &ret, idx);
	}
	delete pPlayer;
	return;
}
Пример #19
0
uint32_t CGamemodeManager::OnPlayerSelectedMenuRow(cell playerid, cell row)
{
	if (!gmIsInit) return 0;

	int idx;
	cell ret = 0;

	if (!amx_FindPublic(&gmAMX, "OnPlayerSelectedMenuRow", &idx))
	{
		amx_Push(&gmAMX, row);
		amx_Push(&gmAMX, playerid);
		amx_Exec(&gmAMX, &ret, idx);
	}
	return (uint32_t)ret;
}
Пример #20
0
uint32_t CGamemodeManager::OnEnterExitModShop(cell playerid, cell enterexit, cell uint32_teriorid)
{
	if (!gmIsInit) return 0;
	int idx;
	cell ret = 1;

	if (!amx_FindPublic(&gmAMX, "OnEnterExitModShop", &idx))
	{
		amx_Push(&gmAMX, uint32_teriorid);
		amx_Push(&gmAMX, enterexit);
		amx_Push(&gmAMX, playerid);
		amx_Exec(&gmAMX, &ret, idx);
	}
	return (uint32_t)ret;
}
Пример #21
0
uint32_t CGamemodeManager::OnPlayerClickPlayerTextDraw(cell playerID, cell textDrawID)
{
	int idx;
	cell ret = 0;

	if (!amx_FindPublic(&gmAMX, "OnPlayerClickPlayerTextDraw", &idx))
	{
		amx_Push(&gmAMX, textDrawID);
		amx_Push(&gmAMX, playerID);
		amx_Exec(&gmAMX, &ret, idx);
		if (ret) return 1;
	}

	return (uint32_t) ret;
}
Пример #22
0
uint32_t CGamemodeManager::OnVehicleDeath(cell vehicleid, cell killerid)
{
	if (!gmIsInit) return 0;

	int idx;
	cell ret = 0;

	if (!amx_FindPublic(&gmAMX, "OnVehicleDeath", &idx))
	{
		amx_Push(&gmAMX, killerid);
		amx_Push(&gmAMX, vehicleid);
		amx_Exec(&gmAMX, &ret, idx);
	}
	return (uint32_t)ret;
}
Пример #23
0
uint32_t CGamemodeManager::OnPlayerStreamIn(cell playerid, cell forplayerid)
{
	if (!gmIsInit) return 0;

	int idx;
	cell ret = 1;

	if(!amx_FindPublic(&gmAMX, "OnPlayerStreamIn", &idx))
	{
		amx_Push(&gmAMX, forplayerid);
		amx_Push(&gmAMX, playerid);
		amx_Exec(&gmAMX, &ret, idx);
	}
	return (uint32_t)ret;
}
Пример #24
0
uint32_t CGamemodeManager::OnVehicleStreamOut(cell vehicleid, cell forplayerid)
{
	if (!gmIsInit) return 0;

	int idx;
	cell ret = 1;

	if(!amx_FindPublic(&gmAMX, "OnVehicleStreamOut", &idx))
	{
		amx_Push(&gmAMX, forplayerid);
		amx_Push(&gmAMX, vehicleid);
		amx_Exec(&gmAMX, &ret, idx);
	}
	return (uint32_t)ret;
}
Пример #25
0
uint32_t CGamemodeManager::OnPlayerObjectMoved(cell playerid, cell objectid)
{
	if (!gmIsInit) return 0;

	int idx;
	cell ret = 0;

	if (!amx_FindPublic(&gmAMX, "OnPlayerObjectMoved", &idx))
	{
		amx_Push(&gmAMX, objectid);
		amx_Push(&gmAMX, playerid);
		amx_Exec(&gmAMX, &ret, idx);
	}

	return (uint32_t)ret;
}
Пример #26
0
static int AMXAPI amx_DGramIdle(AMX *amx, int AMXAPI Exec(AMX *, cell *, int))
{
  char message[BUFLEN], source[SRC_BUFSIZE];
  cell *amx_addr_src;
  int len, chars;
  int err=0;

  assert(idxReceiveString >= 0 || idxReceivePacket >= 0);

  if (PrevIdle != NULL)
    PrevIdle(amx, Exec);

  /* set up listener (first call only) */
  if (!dgramBound) {
    if (dgramPort==0)
      dgramPort=AMX_DGRAMPORT;  /* use default port if none was set */
    if (udp_Listen(dgramPort)==-1)
      return AMX_ERR_GENERAL;
    dgramBound=1;
  } /* if */

  if (udp_IsPacket()) {
    len=udp_Receive(message, sizeof message / sizeof message[0], source);
    amx_PushString(amx,&amx_addr_src,source,1,0);
    /* check the presence of a byte order mark: if it is absent, the received
     * packet is no string; also check the packet size against string length
     */
    if ((message[0]!='\xef' || message[1]!='\xbb' || message[2]!='\xbf'
        || len!=(int)strlen(message)+1 || idxReceiveString<0) && idxReceivePacket>=0)
    {
      /* receive as "packet" */
      amx_Push(amx,len);
      amx_PushArray(amx,NULL,(cell*)message,len);
      err=Exec(amx,NULL,idxReceivePacket);
    } else {
      const char *msg=message;
      if (msg[0]=='\xef' && msg[1]=='\xbb' && msg[2]=='\xbf')
        msg+=3;                 /* skip BOM */
      /* optionally convert from UTF-8 to a wide string */
      if (amx_UTF8Check(msg,&chars)==AMX_ERR_NONE) {
        cell *array=alloca((chars+1)*sizeof(cell));
        cell *ptr=array;
        if (array!=NULL) {
          while (err==AMX_ERR_NONE && *msg!='\0')
            amx_UTF8Get(msg,&msg,ptr++);
          *ptr=0;               /* zero-terminate */
          amx_PushArray(amx,NULL,array,chars+1);
        } /* if */
      } else {
        amx_PushString(amx,NULL,msg,1,0);
      } /* if */
      err=Exec(amx,NULL,idxReceiveString);
    } /* if */
    while (err==AMX_ERR_SLEEP)
      err=Exec(amx,NULL,AMX_EXEC_CONT);
    amx_Release(amx,amx_addr_src);
  } /* if */

  return err;
}
Пример #27
0
uint32_t CGamemodeManager::OnVehicleRespray(cell playerid, cell vehicleid, cell color1, cell color2)
{
	if (!gmIsInit) return 0;
	int idx;
	cell ret = 1;

	if (!amx_FindPublic(&gmAMX, "OnVehicleRespray", &idx))
	{
		amx_Push(&gmAMX, color2);
		amx_Push(&gmAMX, color1);
		amx_Push(&gmAMX, vehicleid);
		amx_Push(&gmAMX, playerid);
		amx_Exec(&gmAMX, &ret, idx);
	}
	return (uint32_t)ret;
}
Пример #28
0
PLUGIN_EXPORT bool PLUGIN_CALL OnVehicleSpawn(int vehicleid)
{
	for (boost::unordered_map<int, int>::iterator i = core->getData()->internalVehicles.begin(); i != core->getData()->internalVehicles.end(); ++i)
	{
		if (i->second == vehicleid)
		{
			for (std::set<AMX*>::iterator a = core->getData()->interfaces.begin(); a != core->getData()->interfaces.end(); ++a)
			{
				int amxIndex = 0;
				if (!amx_FindPublic(*a, "OnDynamicVehicleSpawn", &amxIndex))
				{
					amx_Push(*a, static_cast<cell>(i->first));
					amx_Exec(*a, NULL, amxIndex);
				}
			}
			boost::unordered_map<int, Item::SharedVehicle>::iterator p = core->getData()->vehicles.find(i->first);
			if (p != core->getData()->vehicles.end())
			{
				if (p->second->touched)
				{
					p->second->touched = false;
					p->second->used = true;
				}
			}
			break;
		}
	}
	return true;
}
Пример #29
0
uint32_t CGamemodeManager::OnPlayerClickMap( cell playerID, float posX, float posY, float posZ )
{
	int idx;
	cell ret = 0;

	if(!amx_FindPublic(&gmAMX, "OnPlayerClickMap", &idx)) {

		amx_Push(&gmAMX, amx_ftoc( posZ ) );
		amx_Push(&gmAMX, amx_ftoc( posY ) );
		amx_Push(&gmAMX, amx_ftoc( posX ) );
		amx_Push(&gmAMX, playerID);
		amx_Exec(&gmAMX, &ret, idx);
	}

	return (uint32_t)ret;
}
Пример #30
0
uint32_t CGamemodeManager::OnUnoccupiedVehicleUpdate(cell vehicleid, cell playerid, cell passenger_seat)
{
	if (!gmIsInit) return 0;

	int idx;
	cell ret = 0;

	if(!amx_FindPublic(&gmAMX, "OnUnoccupiedVehicleUpdate", &idx)) {
		amx_Push(&gmAMX, passenger_seat);
		amx_Push(&gmAMX, playerid );
		amx_Push(&gmAMX, vehicleid );
		amx_Exec(&gmAMX, &ret, idx);
	}

	return (uint32_t)ret;
}