ZCMD command gives "invalid name" warning -
Biesmen - 26.05.2011
If you type this command:
pawn Код:
CMD:warn(playerid, params[])
{
new giveplayerid, reason[128];
if(PlayerInfo[playerid][pAdmin] > 0)
{
if(sscanf(params, "us[128]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /warn [Playerid/PartOfName] [Reason]");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected.");
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_RED, "You can't warn this player.");
MaxWarnings[giveplayerid]++;
format(reason, sizeof(reason), "Admin {FF4500}%s(%i){FF0000} has warned {FF4500}%s(%i){FF0000} for: {FF4500}%s {FF0000}(%i/3)", PlayerName(playerid), playerid, PlayerName(giveplayerid), giveplayerid, reason, MaxWarnings[giveplayerid]);
SendClientMessageToAll(COLOR_RED2, reason);
(the rest is just some return stuff)
It will give you this problem:
I've never had this problem before, I never even heard of it.
I've got this problem since I'm using ZCMD. I hope you know a way to solve this, instead of changing from ZCMD to DCMD if it has to do with ZCMD.
Re: ZCMD command gives "invalid name" warning -
DRIFT_HUNTER - 26.05.2011
Its just your nick name
Re: ZCMD command gives "invalid name" warning -
Biesmen - 26.05.2011
Sure, the nickname "Biesmen" will give this error.
Read, I said if I type that command I will get this problem. If it's my nickname I would get this if I connected to the server.
Re: ZCMD command gives "invalid name" warning -
DRIFT_HUNTER - 26.05.2011
Well than give us a full command
I think you change player name somehow
Re: ZCMD command gives "invalid name" warning -
futuretrucker - 26.05.2011
try this.
pawn Код:
CMD:warn(playerid, params[])
{
new giveplayerid, reason[128];
if(PlayerInfo[playerid][pAdmin] > 0)
else if(sscanf(params, "us[128]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /warn [Playerid/PartOfName] [Reason]");
else if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected.");\
else if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_RED, "You can't warn this player.");
else
{
MaxWarnings[giveplayerid]++;
format(reason, sizeof(reason), "Admin {FF4500}%s(%i){FF0000} has warned {FF4500}%s(%i){FF0000} for: {FF4500}%s {FF0000}(%i/3)", PlayerName(playerid), playerid, PlayerName(giveplayerid), giveplayerid, reason, MaxWarnings[giveplayerid]);
SendClientMessageToAll(COLOR_RED2, reason);
}
}
Re: ZCMD command gives "invalid name" warning -
Biesmen - 26.05.2011
Those else statements aren't used in a correct way, it won't work.
Thanks for trying.
@Drift Hunter
-Face palm-
pawn Код:
CMD:warn(playerid, params[])
{
new giveplayerid, reason[128];
if(PlayerInfo[playerid][pAdmin] > 0)
{
if(sscanf(params, "us[128]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /warn [Playerid/PartOfName] [Reason]");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected.");
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_RED, "You can't warn this player.");
MaxWarnings[giveplayerid]++;
format(reason, sizeof(reason), "Admin {FF4500}%s(%i){FF0000} has warned {FF4500}%s(%i){FF0000} for: {FF4500}%s {FF0000}(%i/3)", PlayerName(playerid), playerid, PlayerName(giveplayerid), giveplayerid, reason, MaxWarnings[giveplayerid]);
SendClientMessageToAll(COLOR_RED2, reason);
if(MaxWarnings[giveplayerid] == 3)
{
SendClientMessage(playerid, COLOR_GREY, "You've been kicked for reaching the maximum amount of warnings");
Kick(giveplayerid);
}
}
That's the full code.
Re: ZCMD command gives "invalid name" warning -
DRIFT_HUNTER - 26.05.2011
Quote:
Originally Posted by Biesmen
Those else statements aren't used in a correct way, it won't work.
Thanks for trying.
@Drift Hunter
-Face palm-
pawn Код:
CMD:warn(playerid, params[]) { new giveplayerid, reason[128]; if(PlayerInfo[playerid][pAdmin] > 0) { if(sscanf(params, "us[128]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /warn [Playerid/PartOfName] [Reason]"); if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected."); if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_RED, "You can't warn this player."); MaxWarnings[giveplayerid]++; format(reason, sizeof(reason), "Admin {FF4500}%s(%i){FF0000} has warned {FF4500}%s(%i){FF0000} for: {FF4500}%s {FF0000}(%i/3)", PlayerName(playerid), playerid, PlayerName(giveplayerid), giveplayerid, reason, MaxWarnings[giveplayerid]); SendClientMessageToAll(COLOR_RED2, reason); if(MaxWarnings[giveplayerid] == 3) { SendClientMessage(playerid, COLOR_GREY, "You've been kicked for reaching the maximum amount of warnings"); Kick(giveplayerid); } }
That's the full code.
|
Man when i say full command i mean on whole code for one command ffs
How you think someone will help you if they dont have full code?
pawn Код:
//From here
CMD:command(playerid,params[])
{
//Whole code
return 1;
}
//Until here
Or you forgot return 1 and finish bracket?
Otherwise code looks fine to me
Re: ZCMD command gives "invalid name" warning -
Biesmen - 26.05.2011
Quote:
Originally Posted by DRIFT_HUNTER
Man when i say full command i mean on whole code for one command ffs
How you think someone will help you if they dont have full code?
pawn Код:
//From here CMD:command(playerid,params[]) { //Whole code return 1; } //Until here
Or you forgot return 1 and finish bracket?
Otherwise code looks fine to me
|
I'm sorry again, I think the words are difficult to understand: "The rest is is just som return..". I couldn't be bothered to re-copy for 2 lines. and I said, there's nothing wrong with the code, it's a bug.
Re: ZCMD command gives "invalid name" warning -
Biesmen - 27.05.2011
Edit: Oops, posted accidentally. I meant to edit. I wanted to say it's fixed, I changed to DCMD.