Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dutils>
- #include <sscanf2>
- #pragma unused ret_memcpy
- #define SendClientFormat(%0,%1,%2,%3,%4) format(%2,sizeof(%2),%3,%4), SendClientMessage(%0,%1,%2)
- /*
- * Don't remove the credits!
- ** Filter Script by RaFaeL - Multi private messages
- *** Version: 0.3 [BETA]
- **** Bags to: [email protected] - Thanks!
- */
- public OnFilterScriptInit()
- {
- print("[RaFaeL] multi Private messages V0.3 - Loaded...!");
- return 1;
- }
- //==============================================================================
- public OnFilterScriptExit()
- {
- print("[RaFaeL] multi Private messages V0.3 - unLoaded...!");
- return 1;
- }
- //==============================================================================
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256], params[256], idx, str[128];
- cmd = strtok(cmdtext, idx); params = strrest(cmdtext, idx);
- //=-=-==-=-=-=-=-=-=-=--=-=-=-=-=--=-=-=---=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- if(!strcmp(cmd, "/Pm", true))
- {
- new ids[24], text[128], sendids[5], SendedNames[128], SendedCount; //Veribles for the system
- if(sscanf(params, "s[24]s[128]", ids, text)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /Pm [IDs] [Text]"); //Check if command typed correctly
- sscanf(ids, "p<,>A<i>(-1)[5]", sendids); //Splits the ids -> 1,2,3 will give an array
- for(new i; i<sizeof(sendids); i++) if(sendids[i] != INVALID_PLAYER_ID && IsPlayerConnected(sendids[i]) && sendids[i] != playerid) { //Create a loop to check ids and create names list
- SendedCount++; //Add one to the names count
- new sendid = sendids[i]; //Get the Id
- format(str, sizeof(str), "%s%s", GetName(sendid), (SendedCount > 1)? (", "):("")), strcat(SendedNames, str); //Add the name of the sender to string
- SendClientFormat(sendid, 0xEAFF00FF, str, "[PM] %s(->To You): %s", GetName(playerid), text); //send formated message to players
- }
- return (SendedCount > 0)? (SendClientFormat(playerid, 0x0000FFFF, str, "[PM] %s(->To: %s): %s", GetName(playerid), SendedNames, text)):(SendClientMessage(playerid, 0xFF0000AA, "Wrong IDs!"));//send formated message to player
- }
- //=-=-==-=-=-=-=-=-=-=--=-=-=-=-=--=-=-=---=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- return 0;
- }
- //==============================================================================
- stock strrest(const string[], index)
- {
- new length = strlen(string),offset = index,result[256];
- while((index < length) && ((index - offset) < (sizeof(result) - 1)) && (string[index] > '\r')) result[index - offset] = string[index],index++;
- result[index - offset] = EOS;
- if(result[0] == ' ' && string[0] != ' ') strdel(result,0,1);
- return result;
- }
- stock GetName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- //==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment