20.05.2018, 16:18
hello I wonder if it helps me do an anti spam command or pass me the full scrip zcmd
public OnPlayerConnect(playerid)
{
SetPVarInt(playerid, "PSPAM", 0);
return 1;
}
public OnPlayerDisconnect(playerid)
{
SetPVarInt(playerid, "PSPAM", 0); //reset spam on disconnect
return 1;
}
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(success)
{
SetPVarInt(playerid, "PSPAM", 1); //spam to 1 use pvars so other scripts wont let you spam too
SetTimerEx("SpamDelay", 1000, false, "i", playerid); //delay
}
}
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(GetPVarInt(playerid, "PSPAM") == 1) //if spam still on
{
SendClientMessage(playerid, 0xFF0000FF, "Do not spam!");
return 0; //do not execute the command
}
return 1;
}
forward SpamDelay(playerid);
public SpamDelay(playerid)
{
SetPVarInt(playerid, "PSPAM", 0); //setting to no spam after 1 second
}
public OnPlayerCommandPerformed(playerid, cmdtext[], success) { if(success == 0) { if(ServerInfo[ReadCmds] == 1) { new string[150]; format(string, sizeof(string)-1, "[Unknow CMD] %s [ID: %d] Command: %s", pName(playerid), playerid, cmdtext); foreach (new i : Player) { if(PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= 6 && i != playerid) { SendClientMessage(i, 0xF6BB0AA, string); } } } ShowPlayerDialog(playerid, 199, DIALOG_STYLE_MSGBOX, "{b0b0b0}ERROR:Unknow Command", "\n{c6e2ff}you have typed an unknow commands.\n\n{c6e2ff}you can spawn any vehicles by type /veh\n\n{c6e2ff}Type /cmds and cmds2 to display the most commonly used commands", "Aceptar", ""); return 1; } else if(success == 1) { if(ServerInfo[ReadCmds] == 1) { new string[150]; format(string, sizeof(string)-1, "[CMD] %s [ID: %d] Command: %s", pName(playerid), playerid, cmdtext); foreach (new i : Player) { if(PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= 6 && i != playerid) { SendClientMessage(i, 0xF6BB0AA, string); } } } } return 1; } if(success) { SetPVarInt(playerid, "PSPAM", 1); //spam to 1 use pvars so other scripts wont let you spam too SetTimerEx("SpamDelay", 1000, false, "i", playerid); //delay } }
public OnPlayerCommandReceived(playerid, cmdtext[]) { if(PlayerInfo[playerid][Registered] == 1 && PlayerInfo[playerid][LoggedIn] == 0) if(strcmp(cmdtext,"/forgotpassword", true) == 1 || strcmp(cmdtext,"/forgotpassword", true) == -1 && strcmp(cmdtext,"/login", true) == 1 || strcmp(cmdtext,"/login", true) == -1) { SendClientMessage(playerid,red,"You are registered and not logged in!, login to use commands"); return 1; } return 0; } if(GetPVarInt(playerid, "PSPAM") == 1) //if spam still on { SendClientMessage(playerid, 0xFF0000FF, "Do not spam!"); return 0; //do not execute the command } return 1; }
error
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success) { if(success == 0) { if(ServerInfo[ReadCmds] == 1) { new string[150]; format(string, sizeof(string)-1, "[Unknow CMD] %s [ID: %d] Command: %s", pName(playerid), playerid, cmdtext); foreach (new i : Player) { if(PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= 6 && i != playerid) { SendClientMessage(i, 0xF6BB0AA, string); } } } ShowPlayerDialog(playerid, 199, DIALOG_STYLE_MSGBOX, "{b0b0b0}ERROR:Unknow Command", "\n{c6e2ff}you have typed an unknow commands.\n\n{c6e2ff}you can spawn any vehicles by type /veh\n\n{c6e2ff}Type /cmds and cmds2 to display the most commonly used commands", "Aceptar", ""); return 1; } else if(success == 1) { if(ServerInfo[ReadCmds] == 1) { new string[150]; format(string, sizeof(string)-1, "[CMD] %s [ID: %d] Command: %s", pName(playerid), playerid, cmdtext); foreach (new i : Player) { if(PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= 6 && i != playerid) { SendClientMessage(i, 0xF6BB0AA, string); } } } } return 1; } if(success) { SetPVarInt(playerid, "PSPAM", 1); //spam to 1 use pvars so other scripts wont let you spam too SetTimerEx("SpamDelay", 1000, false, "i", playerid); //delay } } Код:
public OnPlayerCommandReceived(playerid, cmdtext[]) { if(PlayerInfo[playerid][Registered] == 1 && PlayerInfo[playerid][LoggedIn] == 0) if(strcmp(cmdtext,"/forgotpassword", true) == 1 || strcmp(cmdtext,"/forgotpassword", true) == -1 && strcmp(cmdtext,"/login", true) == 1 || strcmp(cmdtext,"/login", true) == -1) { SendClientMessage(playerid,red,"You are registered and not logged in!, login to use commands"); return 1; } return 0; } if(GetPVarInt(playerid, "PSPAM") == 1) //if spam still on { SendClientMessage(playerid, 0xFF0000FF, "Do not spam!"); return 0; //do not execute the command } return 1; } C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36725) : error 010: invalid function or declaration C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36727) : error 010: invalid function or declaration C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36755) : warning 217: loose indentation C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36757) : error 010: invalid function or declaration Pawn compiler 3.2.3664 |
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
{
if(ServerInfo[ReadCmds] == 1)
{
new string[150];
format(string, sizeof(string)-1, "[Unknow CMD] %s [ID: %d] Command: %s", pName(playerid), playerid, cmdtext);
foreach (new i : Player)
{
if(PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= 6 && i != playerid)
{
SendClientMessage(i, 0xF6BB0AA, string);
}
}
}
ShowPlayerDialog(playerid, 199, DIALOG_STYLE_MSGBOX, "{b0b0b0}ERROR:Unknow Command", "\n{c6e2ff}you have typed an unknow commands.\n\n{c6e2ff}you can spawn any vehicles by type /veh\n\n{c6e2ff}Type /cmds and cmds2 to display the most commonly used commands", "Aceptar", "");
return 1;
}
else
{
if(ServerInfo[ReadCmds] == 1)
{
new string[150];
format(string, sizeof(string)-1, "[CMD] %s [ID: %d] Command: %s", pName(playerid), playerid, cmdtext);
foreach (new i : Player)
{
if(PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= 6 && i != playerid)
{
SendClientMessage(i, 0xF6BB0AA, string);
}
}
}
SetPVarInt(playerid, "PSPAM", 1); //spam to 1 use pvars so other scripts wont let you spam too
SetTimerEx("SpamDelay", 1000, false, "i", playerid); //delay
return 1;
}
return 1;
}
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(PlayerInfo[playerid][Registered] == 1 && PlayerInfo[playerid][LoggedIn] == 0)
{
if(strcmp(cmdtext,"/forgotpassword", true) == 1 || strcmp(cmdtext,"/forgotpassword", true) == -1 && strcmp(cmdtext,"/login", true) == 1 || strcmp(cmdtext,"/login", true) == -1)
{
SendClientMessage(playerid,red,"You are registered and not logged in!, login to use commands");
return 1;
}
return 0;
}
if(GetPVarInt(playerid, "PSPAM") == 1) //if spam still on
{
SendClientMessage(playerid, 0xFF0000FF, "Do not spam!");
return 0; //do not execute the command
}
return 1;
}
Try this:
PHP код:
|