My warn command is not functioning properly. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: My warn command is not functioning properly. (
/showthread.php?tid=264574)
My warn command is not functioning properly. -
kin - 26.06.2011
Well, this is a weird bug, its with the command IsPlayerConnected. It tells me the player is not connected when he actually is...
code:
pawn Код:
dcmd_warn(playerid,params[])
{
if(Info[playerid] [Level] >= 2||Info[playerid] [TempLevel] >=2)
{
new sname[128],gname[128],player,reason,str[128],warn[MAX_PLAYERS];
GetPlayerName(playerid,sname,sizeof(sname));
if(sscanf(params,"us[128]",player,reason))return SendClientMessage(playerid,-1,"{FF7300}[SYSTEM]{D1D1D1} Usage: /warn [Player/Playerid] [Reason]");
{
GetPlayerName(player,gname,sizeof(gname));
if(!IsPlayerConnected(player))return SendClientMessage(playerid,-1,offline);
{
if(warn[player]<3)
{
warn[player] = warn[player] +1;
format(str,sizeof(str),"{FF7300}[SYSTEM]{D1D1D1} %s has been warned by %s [Reason:%s] [%i/3]",gname,sname,warn[player]);
SendClientMessageToAll(-1,str);
}
else
{
format(str,sizeof(str),"{FF7300}[SYSTEM]{D1D1D1} %s has been auto kicked [Reason: Exceeded max ammount of warnings] [3/3]",gname);
SendClientMessageToAll(-1,str);
Kick(player);
}
}
}
}
else
{
SendClientMessage(playerid,-1,authorized);
}
return 1;
}
Re: My warn command is not functioning properly. -
Macluawn - 26.06.2011
pawn Код:
dcmd_warn(playerid,params[])
{
new sname[MAX_PLAYER_NAME],
gname[MAX_PLAYER_NAME],
player,
reason,
str[128],
warn[MAX_PLAYERS];
if(Info[playerid][Level] < 2 && Info[playerid][TempLevel] < 2) SendClientMessage(playerid,-1,authorized);
if(sscanf(params,"us[128]",player,reason))return SendClientMessage(playerid,-1,"{FF7300}[SYSTEM]{D1D1D1} Usage: /warn [Player/Playerid] [Reason]");
if(!IsPlayerConnected(player))return SendClientMessage(playerid,-1,offline);
GetPlayerName(player,gname,sizeof(gname));
if(warn[player]<3)
{
GetPlayerName(playerid,sname,sizeof(sname));
warn[player] = warn[player] +1;
format(str,sizeof(str),"{FF7300}[SYSTEM]{D1D1D1} %s has been warned by %s [Reason:%s] [%i/3]",gname,sname,warn[player]);
SendClientMessageToAll(-1,str);
}
else
{
format(str,sizeof(str),"{FF7300}[SYSTEM]{D1D1D1} %s has been auto kicked [Reason: Exceeded max ammount of warnings] [3/3]",gname);
SendClientMessageToAll(-1,str);
Kick(player);
}
return 1;
}
Use zcmd or ycmd. They are much faster than dcmd.
Re: My warn command is not functioning properly. -
kin - 29.06.2011
Quote:
Originally Posted by Macluawn
pawn Код:
dcmd_warn(playerid,params[]) { new sname[MAX_PLAYER_NAME], gname[MAX_PLAYER_NAME], player, reason, str[128], warn[MAX_PLAYERS]; if(Info[playerid][Level] < 2 && Info[playerid][TempLevel] < 2) SendClientMessage(playerid,-1,authorized); if(sscanf(params,"us[128]",player,reason))return SendClientMessage(playerid,-1,"{FF7300}[SYSTEM]{D1D1D1} Usage: /warn [Player/Playerid] [Reason]"); if(!IsPlayerConnected(player))return SendClientMessage(playerid,-1,offline); GetPlayerName(player,gname,sizeof(gname)); if(warn[player]<3) { GetPlayerName(playerid,sname,sizeof(sname)); warn[player] = warn[player] +1; format(str,sizeof(str),"{FF7300}[SYSTEM]{D1D1D1} %s has been warned by %s [Reason:%s] [%i/3]",gname,sname,warn[player]); SendClientMessageToAll(-1,str); } else { format(str,sizeof(str),"{FF7300}[SYSTEM]{D1D1D1} %s has been auto kicked [Reason: Exceeded max ammount of warnings] [3/3]",gname); SendClientMessageToAll(-1,str); Kick(player); } return 1; }
Use zcmd or ycmd. They are much faster than dcmd.
|
Could care less about the speed, sorry to say. As zcmd or ycmd is harder to understand, i have been using dcmd since i started, i have also been using dini. I figured it out anyways, i didnt make reason, reason[128]
Re: My warn command is not functioning properly. -
PrawkC - 29.06.2011
harder to understand? ahahah, you pretty much just change dcmd_name to CMD:name ... gee that was hard.