Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Simple Accent Command
- Scripter: Franck_ | Cristiano_(Aveiro)
- Date: 05.02.2011
- Version: V1.0
- Mode: Command.
- */
- #define FILTERSCRIPT
- #include <a_samp>
- new pAccent[MAX_PLAYERS][26];
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print(" Accent System by Franck_ | Cristiano_(Aveiro) Loaded ");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print(" Accent System by Franck_ | Cristiano_(Aveiro) Unloaded ");
- return 1;
- }
- stock strtok(const string[], &index,seperator=' ')
- {
- new length = strlen(string);
- new offset = index;
- new result[128];
- while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- if ((index < length) && (string[index] == seperator))
- {
- index++;
- }
- return result;
- }
- public OnPlayerConnect(playerid)
- {
- new string[] = " ";
- strmid(pAccent[playerid],string,0,sizeof string ,255);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new string[] = " ";
- strmid(pAccent[playerid],string,0,sizeof string ,255);
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- new string[256];
- if(strlen(pAccent[playerid]) > 0)
- {
- format(string,sizeof(string),"[%s accent] %s",pAccent[playerid],text);
- SendPlayerMessageToAll(playerid,string);
- return 0;
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- new tmp[256];
- new string[128];
- new idx;
- cmd = strtok(cmdtext, idx);
- if(!strcmp(cmd,"/accent", true))
- {
- if(IsPlayerConnected(playerid))
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp) || strlen(tmp) <= 6 || strlen(tmp) > 26)
- {
- SendClientMessage(playerid,0xFFFFFFAA,"Usage: /accent {58A624}[ accent name ]{FFFFFF}.");
- SendClientMessage(playerid,0xFFFFFFAA,"Example: {58A624}/accent Portuguese ");
- return 1;
- }
- format(string,sizeof(string),"Accent: You have changed your accent to {58A624}%s.",tmp);
- SendClientMessage(playerid,0xFFFFFFAA,string);
- strmid(pAccent[playerid],tmp,0,sizeof(tmp),255);
- }
- return 1;
- }
- return 0;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment