Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cell AMX_NATIVE_CALL GetScriptKeyFromIdentifier(AMX* amx, cell* params)
- {
- int len;
- cell *addr = NULL;
- amx_GetAddr(amx, params[1], &addr);
- amx_StrLen(addr, &len);
- char scriptIdentifier_cstr[SCRIPT_IDENTIFIER_SIZE];
- amx_GetString(scriptIdentifier_cstr, addr, 0, SCRIPT_IDENTIFIER_SIZE);
- std::string scriptIdentifier = scriptIdentifier_cstr; //THIS IS KILLING ME; I have to make a copy of a C string
- cell * scriptID;
- amx_GetAddr(amx, params[2], &scriptID);
- int count = 0;
- for (auto amx_interface = InterfaceList.begin(), interface_list_end = InterfaceList.end(); amx_interface != interface_list_end; amx_interface++)
- {
- if (scriptIdentifier == (*amx_interface).ScriptIdentifier)
- {
- if (count < static_cast<int>(params[3]))
- {
- *scriptID++ = static_cast<cell>((*amx_interface).ScriptKey);
- count++;
- }
- }
- }
- return static_cast<cell>(count);
- }
Add Comment
Please, Sign In to add comment