/lang command help -
XVK - 04.08.2011
pawn Code:
#include <a_samp>
#include <ladmin>
forward null(playerid);
new Muted[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/lang", cmdtext))
{
if(!IsPlayerVipType(playerid,3)) return SendClientMessage(playerid, 0xE60000FF, "ERROR: You can not language mute a player!");
{
new id[MAX_PLAYERS],str[128];
if(!strval(cmdtext)) return SendClientMessage(playerid,0xFF0000FF,"Usage: /lang [ID]");
if(Muted[playerid] == 1) return SendClientMessage(playerid,0xFF0000FF,"Player is already language muted!");
if(!IsPlayerConnected(id[playerid])) return SendClientMessage(playerid,0xFF0000FF,"Player is not Connected");
Muted[playerid] = 1;
format(str,sizeof(str),"You language muted %s, he will get auto unmuted in 3 minutes.",id);
SendClientMessage(playerid,0xFFFF00FF,str);
SetTimerEx("null", 180000, false, "i", playerid);
new name[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has been muted, he needs to wait 3 minutes to get unmuted or an Admin or VIP Member can unmute him.",name);
SendClientMessageToAll(0xFFFF00FF, string);
}
return 1;
}
if(!strcmp("/unlang", cmdtext))
{
if(!IsPlayerVipType(playerid,3)) return SendClientMessage(playerid, 0xE60000FF, "ERROR: You can not language mute a player!");
{
new id[MAX_PLAYERS],str[128];
if(!strval(cmdtext)) return SendClientMessage(playerid,0xFF0000FF,"Usage: /unlang [ID]");
if(Muted[playerid] == 0) return SendClientMessage(playerid,0xFF0000FF,"Player isn't language muted!");
if(!IsPlayerConnected(id[playerid])) return SendClientMessage(playerid,0xFF0000FF,"Player is not Connected");
Muted[playerid] = 0;
format(str,sizeof(str),"You unmuted %s.",id);
SendClientMessage(playerid,0xFFFF00FF,str);
new name[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has been unmuted.",name);
SendClientMessageToAll(0xFFFF00FF, string);
}
return 1;
}
return 0;
}
public OnPlayerText(playerid, text[])
{
if(Muted[playerid] == 1) return SendClientMessage(playerid,0xFF0000FF,"ERROR: You are language muted and cannot talk.");
return 1;
}
public null(playerid)
{
Muted[playerid] = 0;
new name[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has been auto unmuted.",name);
SendClientMessageToAll(0xFFFF00FF, string);
return 1;
}
When I enter the player id it says server unknown command.
Re: /lang command help -
fie - 04.08.2011
Hmm I used to have a bug like this.
Does it compile with any errors ? Because sometimes of it ha errors and it compiles aswell it can lead to this.
Hope this helped
Re: /lang command help -
=WoR=Varth - 05.08.2011
pawn Code:
if(!strcmp("/lang", cmdtext))
{
if(!IsPlayerVipType(playerid,3)) return SendClientMessage(playerid, 0xE60000FF, "ERROR: You can not language mute a player!");
new id[MAX_PLAYERS],str[128];
if(!strval(cmdtext)) return SendClientMessage(playerid,0xFF0000FF,"Usage: /lang [ID]");
if(Muted[playerid] == 1) return SendClientMessage(playerid,0xFF0000FF,"Player is already language muted!");
if(!IsPlayerConnected(id[playerid])) return SendClientMessage(playerid,0xFF0000FF,"Player is not Connected");
Muted[playerid] = 1;
format(str,sizeof(str),"You language muted %s, he will get auto unmuted in 3 minutes.",id);
SendClientMessage(playerid,0xFFFF00FF,str);
SetTimerEx("null", 180000, false, "i", playerid);
new name[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has been muted, he needs to wait 3 minutes to get unmuted or an Admin or VIP Member can unmute him.",name);
SendClientMessageToAll(0xFFFF00FF, string);
return 1;
}
Re: /lang command help -
XVK - 05.08.2011
still doesn't work please help me, no errors
Re: /lang command help -
=WoR=Varth - 05.08.2011
Did you get any message?
Re: /lang command help -
XVK - 05.08.2011
no just loose indentation
Re: /lang command help -
=WoR=Varth - 05.08.2011
I mean message in game.
"%s has been muted, he needs to wait 3 minutes to get unmuted or an Admin or VIP Member can unmute him." or something else.
Re: /lang command help -
XVK - 05.08.2011
I tryed it on me. and nothing.
Re: /lang command help -
=WoR=Varth - 05.08.2011
I get it. It's because you don't extract the string "cmdtext" to get id value.
Sorry I have no idea how to use strcmp for command processor.
I may suggest you to use ZCMD and SSCANF.
Re: /lang command help -
XVK - 05.08.2011
could you help me with it, if possible?