Removing a few lines - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Removing a few lines (
/showthread.php?tid=569718)
Removing a few lines -
nicholasramdhan - 02.04.2015
Код:
public OnPlayerText(playerid, text[])
{
if (!IsPlayerConnected( playerid )) return 0; // Check for undisconnected bug.
new
i,
c;
while ((c = text[i++])) if (c < 0x20 || c > 0x7E) return 0; // Check for illegal characters.
if(PlayerInfo[playerid][ pMuted ]==1) {
SendClientMessage(playerid, COLOR_RED, "You're muted!");
return 0;
}
if(LastText[playerid][0] != 0 && strcmp(LastText[playerid], text, false) == 0) {
SendClientMessage(playerid, COLOR_RED, "[Failed] Do not repeat yourself."); // If successful, SendClientMessage() returns 1, so if you use return SendClientMessage, it will still send the player's text.
return 0; // Blocking the text from being sent.
}
for(new j; j < sizeof(LastText[]); j++)
LastText[playerid][j] = 0; // Wiping the array, so that messages shorter than the last message will not have the end of the last message on them.
format(LastText[playerid], sizeof(LastText[]), text);
if (text[0] == '!')
{
new string[256], name[24];
GetPlayerName(playerid, name, 24);
format(string, 256, "[TEAMCHAT] %s: %s", name, text[1]);
for (new a=0; a<SLOTS; a++) {
if (IsPlayerConnected(a)) {
if (GetPlayerTeam(a) == GetPlayerTeam(playerid)) {
add_log( string );
SendClientMessage(a, AZTECAS_COLOR, string);
}
}
}
return 0;
}
return 1; // Sending the text if it was not the same as the player's last message.
}
I need to remove the
Код:
if (text[0] == '!')
{
new string[256], name[24];
GetPlayerName(playerid, name, 24);
format(string, 256, "[TEAMCHAT] %s: %s", name, text[1]);
for (new a=0; a<SLOTS; a++) {
if (IsPlayerConnected(a)) {
if (GetPlayerTeam(a) == GetPlayerTeam(playerid)) {
add_log( string );
SendClientMessage(a, AZTECAS_COLOR, string);
I tried to remove it but I got a few warnings about invalid declaration or whatever, so I just put it all back.
I'm not that good with aligning the return 1; and the brackets and alla that, so if someone can remove the TEAMCHAT and do it for me, it would be greatly appreciated. Thanks
Re: Removing a few lines -
Ryan_Bowe - 02.04.2015
Код:
public OnPlayerText(playerid, text[])
{
if (!IsPlayerConnected( playerid )) return 0; // Check for undisconnected bug.
new
i,
c;
while ((c = text[i++])) if (c < 0x20 || c > 0x7E) return 0; // Check for illegal characters.
if(PlayerInfo[playerid][ pMuted ]==1) {
SendClientMessage(playerid, COLOR_RED, "You're muted!");
return 0;
}
if(LastText[playerid][0] != 0 && strcmp(LastText[playerid], text, false) == 0) {
SendClientMessage(playerid, COLOR_RED, "[Failed] Do not repeat yourself."); // If successful, SendClientMessage() returns 1, so if you use return SendClientMessage, it will still send the player's text.
return 0; // Blocking the text from being sent.
}
for(new j; j < sizeof(LastText[]); j++)
LastText[playerid][j] = 0; // Wiping the array, so that messages shorter than the last message will not have the end of the last message on them.
format(LastText[playerid], sizeof(LastText[]), text);
return 1; // Sending the text if it was not the same as the player's last message.
}
Re: Removing a few lines -
Pottus - 02.04.2015
if (!IsPlayerConnected( playerid )) return 0; // Check for undisconnected bug.
That made me laugh, obviously the player is connected if they typed the command duh....