Help with zcmd command -
Lidor124 - 10.04.2014
I made a command for only who family member able to use this.
so my problem is that i didn't write it good probably and i dont know what wrong.
have a quick look on the code and then read under this:
Код:
CMD:gf(playerid, params[])
{
new string[128], family;
if(PlayerInfo[playerid][pFMember] < 255)
{
if(sscanf(params, "d", family)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gf [familyid] (Type /families)");
if(family > 14 || family < 1) return SendTDMessage(playerid, COLOR_WHITE, "FamilyID cannot be lower than 1 and greater than 14.");
SetPVarInt(playerid, "FamilyInto", family);
}
if(GetPVarInt(playerid, "FamilyInto") >= 1)
{
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gf [Global OOC families chat]");
foreach(Player, i) if(PlayerInfo[i][pFMember] < 255)
{
format(string, sizeof(string), "(( OOC Families chat %s: %s ))", GetPlayerNameEx(playerid), params);
SendClientMessage(i, COLOR_GF, string);
}
else
{
SendTDMessage(playerid, COLOR_WHITE, "You haven't set the FamilyID you wish talk to.");
}
}
else
{
SendTDMessage(playerid, COLOR_WHITE, "You're not a part of a Family!");
}
return 1;
}
At first use command /gf it should send me this: (that works)
Код:
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gf [familyid] (Type /families)");
after i set the number of family i wanted to talk to it, it should send me this:
Код:
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gf [Global OOC families chat]");
Then i can talk to this family freely (the isnull params)
The problem is that it keeps sending me
Код:
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gf [familyid] (Type /families)");
Thanks in advance, +REP will make you more to help me ah
AW: Help with zcmd command -
Nero_3D - 10.04.2014
Thats probably because you try to send a message and it isn't an integer so sscanf stops
You just need to change the order
pawn Код:
CMD:gf(playerid, params[])
{
if(GetPVarInt(playerid, "FamilyInto") >= 1)
{
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gf [Global OOC families chat]");
foreach(Player, i) if(PlayerInfo[i][pFMember] < 255)
{
new string[128];
format(string, sizeof(string), "(( OOC Families chat %s: %s ))", GetPlayerNameEx(playerid), params);
return SendClientMessage(i, COLOR_GF, string);
}
return SendTDMessage(playerid, COLOR_WHITE, "You haven't set the FamilyID you wish talk to.");
}
if(PlayerInfo[playerid][pFMember] < 255)
{
new family;
if(sscanf(params, "d", family)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gf [familyid] (Type /families)");
if(family > 14 || family < 1) return SendTDMessage(playerid, COLOR_WHITE, "FamilyID cannot be lower than 1 and greater than 14.");
return SetPVarInt(playerid, "FamilyInto", family);
}
return SendTDMessage(playerid, COLOR_WHITE, "You're not a part of a Family!");
}