23.01.2013, 08:56
Strcmp? Ugh, I suggest using ZCMD
Also.. You have formatted strings but not supplied any action?
I have cleaned up the code a bit, this should work now, haven't used strcmp for years though so mail me if this doesn't work and no one gets back to you because I am popping into town for a couple hours.
Also.. You have formatted strings but not supplied any action?
I have cleaned up the code a bit, this should work now, haven't used strcmp for years though so mail me if this doesn't work and no one gets back to you because I am popping into town for a couple hours.
pawn Код:
if(strcmp(cmd, "/newbie", true) == 0 || strcmp(cmd, "/n", true) == 0)
{
if(IsPlayerConnected(playerid))
{
//if(PlayerVip[playerid][VipLevel] != 4)
if(PlayerVip[playerid][VipLevel] < 4)
{
if(PlayerInfo[playerid][pLevel] > 18)
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_BLUE, "[NewbieChat] You can't access this chat.");
return 1;
}
}
} //{SendClientMessage(playerid, COLOR_SERVER, noAcces); return 1;}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, COLOR_BLUE, "[NewbieChat] You are muted and can't speak.");
return 1;
}
if(nonewbie == 1)
{
SendClientMessage(playerid, COLOR_BLUE, "[NewbieChat] This channel was desactivated by an admin.");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_USAGE, "{FF6600}[Action]{99EEFF} (/n)ewbie <Texte>");
return 1;
}
//new paral;
new sendername[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pLevel] < 18)
{
format(string, sizeof(string), "[NewbieChat] Newbie %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
else if(PlayerVip[playerid][VipLevel] == 4)
{
format(string, sizeof(string), "[NewbieChat] Helper %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
else if(PlayerInfo[playerid][pAdmin] == 1)
{
format(string, sizeof(string), "[NewbieChat] Moderator lv1 %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
else if(PlayerInfo[playerid][pAdmin] == 2)
{
format(string, sizeof(string), "[NewbieChat] Moderator lv2 %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
else if(PlayerInfo[playerid][pAdmin] == 3)
{
format(string, sizeof(string), "[NewbieChat] Administrator %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
else if(PlayerInfo[playerid][pAdmin] == 4)
{
format(string, sizeof(string), "[NewbieChat] Fondator %s: %s", sendername, result);
SendClientMessage(playerid, COLOR_NEWBIE, string);
return 1;
}
printf("[NewbieChat] %s : %s", playername,result);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error: Please login before using this command.");
return 1;
}
return 1;
}