Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <core>
- #include <float>
- #define MESSAGE_COLOR 0xEEEEEEFF
- #define ECHO_COLOR 0xEEEEEEFF
- #define ACTION_COLOR 0xEE66EEFF
- #define AD_COLOR 0xFF6600FF
- #define DICE_COLOR 0x33FF00FF
- public OnFilterScriptInit()
- {
- print("\n--Chat Commands loaded! - By [TCL]Evrim\n");
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- new Message[256];
- new AdMessage[256];
- new Dice;
- new idx;
- new actiontext[MAX_CHATBUBBLE_LENGTH+1];
- new talktext[MAX_CHATBUBBLE_LENGTH+1];
- new gambletext[MAX_CHATBUBBLE_LENGTH+1];
- new adtext[256];
- cmd = strtok(cmdtext, idx);
- if(strcmp("/me", cmd, true) == 0)
- {
- Message = strrest(cmdtext,idx);
- new Playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Playername, 24);
- format(actiontext,MAX_CHATBUBBLE_LENGTH,"*%s %s*",Playername, Message);
- SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,15.0,10000);
- SendClientMessage(playerid,ACTION_COLOR,actiontext);
- return 1;
- }
- if(strcmp("/l", cmd, true) == 0)
- {
- Message = strrest(cmdtext,idx);
- new Playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Playername, 24);
- format(talktext,MAX_CHATBUBBLE_LENGTH,"%s says: %s",Playername, Message);
- SetPlayerChatBubble(playerid,talktext,MESSAGE_COLOR,20.0,10000);
- SendClientMessage(playerid,MESSAGE_COLOR,talktext);
- return 1;
- }
- if(strcmp("/dice", cmd, true) == 0)
- {
- new Playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Playername, 24);
- Dice = random(6);
- format(gambletext,MAX_CHATBUBBLE_LENGTH,"*%s rolled a %d with his/her dice*",Playername, Dice);
- SetPlayerChatBubble(playerid,gambletext,DICE_COLOR,15.0,10000);
- SendClientMessage(playerid,DICE_COLOR,gambletext);
- return 1;
- }
- if(strcmp("/ad", cmd, true) == 0)
- {
- AdMessage = strrest(cmdtext,idx);
- new Playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Playername, 24);
- format(adtext,256,"[Advertise] %s , contact %s",AdMessage, Playername);
- SendClientMessageToAll(AD_COLOR,adtext);
- GivePlayerMoney(playerid, -10);
- return 1;
- }
- if(strcmp("/creds", cmd, true) == 0)
- {
- SendClientMessage(playerid,ECHO_COLOR,"Chat Commands made by [TCL]Evrim");
- return 1;
- }
- if(strcmp("/smoke", cmd, true) == 0)
- {
- new Playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Playername, 24);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
- format(actiontext,MAX_CHATBUBBLE_LENGTH,"*%s takes out a cigarette and lights it*",Playername);
- SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,15.0,10000);
- SendClientMessage(playerid,ACTION_COLOR,actiontext);
- return 1;
- }
- if(strcmp("/beer", cmd, true) == 0)
- {
- new Playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Playername, 24);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
- format(actiontext,MAX_CHATBUBBLE_LENGTH,"*%s takes out a bottle of beer from his pocket*",Playername);
- SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,15.0,10000);
- SendClientMessage(playerid,ACTION_COLOR,actiontext);
- return 1;
- }
- if(strcmp("/sprunk", cmd, true) == 0)
- {
- new Playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Playername, 24);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
- format(actiontext,MAX_CHATBUBBLE_LENGTH,"*%s takes out a can of sprunk from his pocket*",Playername);
- SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,15.0,10000);
- SendClientMessage(playerid,ACTION_COLOR,actiontext);
- return 1;
- }
- return 0;
- }
- stock strrest(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[128];
- while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- stock strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement