Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Command from Fort Carson Roleplay (http://forum.sa-mp.com/showthread.php?t=272263) */
- // Original command with string comparison and strtok-sourced parsing
- if(strcmp(cmd,"/i",true)==0)
- {
- if(IsPlayerConnected(playerid))
- {
- if(PlayerInfo[playerid][pPlayersChannel] == 999)
- {
- SendClientMessage(playerid, COLOR_GREY, " You are not in an IRC Channel !");
- return 1;
- }
- if(PlayerInfo2[Mute][playerid] == 1)
- {
- SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
- return 1;
- }
- GetPlayerName(playerid, sendername, sizeof(sendername));
- new length = strlen(cmdtext);
- while ((idx < length) && (cmdtext[idx] <= ' '))
- {
- idx++;
- }
- new offset = idx;
- new result[128];
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
- {
- result[idx - offset] = cmdtext[idx];
- idx++;
- }
- result[idx - offset] = EOS;
- if(!strlen(result))
- {
- SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /i [irc chat]");
- return 1;
- }
- format(string, sizeof(string), "** IRC %s: %s. **", sendername, result);
- SendIRCMessage(PlayerInfo[playerid][pPlayersChannel], COLOR_YELLOW2, string);
- }
- return 1;
- }
- // Improved command using zcmd and sscanf (also, removed IsPlayerConnected check - how would the player type the command if they weren't connected???)
- CMD:i(playerid, params[])
- {
- if(PlayerInfo[playerid][pPlayersChannel] == 999)
- return SendClientMessage(playerid, COLOR_GREY, " You are not in an IRC channel!"), true;
- if(PlayerInfo2[Mute][playerid])
- return SendClientMessage(playerid, COLOR_GREY, "You cannot speak, you have been silenced!"), true;
- if(isnull(params))
- return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /i [irc chat]"), true;
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "** IRC %s: %s. **", sendername, result);
- SendIRCMessage(PlayerInfo[playerid][pPlayersChannel], COLOR_YELLOW2, string);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment