zcmd Help. (2) -
Alex_Obando - 31.03.2011
I have this code, But when I go in-game and do /aacc It says Unknow Command.
Can anyone help me to fix it? (Please test it first)
And I want to add either that if the player accepts the invite then make him admin level 5
pawn Код:
#include <a_samp>
#include <zcmd>
native sscanf(const data[], const format[], {Float,_}:...);
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xA10000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
CMD:Aacc(playerid, params[])
{
new id;
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, COLOR_RED, "You are not [A] Member");
if(sscanf(params, "u", id))
return SendClientMessage(playerid, COLOR_WHITE, "Wrong Player ID!");
new string[128];
format(string, sizeof(string), "%s(%d) has invited you to be [A] Do you Accept? /acceptinvite, or You decline? /declineinvite?", GetName(playerid), playerid);
SendClientMessage(id, COLOR_YELLOW, string);
format(string, sizeof(string), "You have invited %s(%d) to be an [A] Member.", GetName(id), id);
SendClientMessage(playerid, COLOR_YELLOW, string);
SetPVarInt(id, "[A]Invite", 1);
SetPVarInt(id, "[A]Inviter", playerid);
return 1;
}
CMD:acceptinvite(playerid, params[])
{
if(GetPVarInt(playerid, "[A]Invite") != 1)
return SendClientMessage(playerid, COLOR_RED, "Sorry, you haven't been Invited to be a Member.");
new pNewName[27];
format(pNewName, sizeof(pNewName), "[A]%s", GetName(playerid));
SetPlayerName(playerid, pNewName);
new string[128];
new id = GetPVarInt(playerid, "[A]Inviter");
format(string, sizeof(string), "%s(%d) has accepted your invite, %s is not an [A] Member.", GetName(playerid), playerid, GetName(playerid));
SendClientMessage(id, COLOR_GREEN, string);
format(string, sizeof(string), "You have accepted %s(%d)'s invite, You are now an [A] member, Welcome!", GetName(id), GetPVarInt(playerid, "[A]Inviter"));
SendClientMessage(playerid, COLOR_GREEN, string);
DeletePVar(playerid, "[A]Invite");
DeletePVar(playerid, "[A]Inviter");
return 1;
}
CMD:declineinvite(playerid, params[])
{
if(GetPVarInt(playerid, "[A]Invite") != 1)
return SendClientMessage(playerid, COLOR_RED, "Sorry, you haven't been invited to be [A]");
new string[128];
new id = GetPVarInt(playerid, "[A]Inviter");
format(string, sizeof(string), "%s(%d) has declined your invite!", GetName(playerid), playerid);
SendClientMessage(id, COLOR_RED, string);
format(string, sizeof(string), "You have declined %s(%d)'s invite, You won't be [A] Member Anymore.", GetName(id), GetPVarInt(playerid, "[A]Inviter"));
SendClientMessage(playerid, COLOR_RED, string);
DeletePVar(playerid, "[A]Invite");
DeletePVar(playerid, "[A]Inviter");
return 1;
}
stock GetName(playerid)
{
new pName[24];
GetPlayerName(playerid, pName, sizeof(pName));
return pName;
}
Re: zcmd Help. (2) -
Garry Roger - 31.03.2011
pawn Код:
#include <a_samp>
#include <zcmd>
native sscanf(const data[], const format[], {Float,_}:...);
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xA10000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
CMD:aacc(playerid, params[])
{
new id;
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, COLOR_RED, "You are not [A] Member");
if(sscanf(params, "u", id))
return SendClientMessage(playerid, COLOR_WHITE, "Wrong Player ID!");
new string[128];
format(string, sizeof(string), "%s(%d) has invited you to be [A] Do you Accept? /acceptinvite, or You decline? /declineinvite?", GetName(playerid), playerid);
SendClientMessage(id, COLOR_YELLOW, string);
format(string, sizeof(string), "You have invited %s(%d) to be an [A] Member.", GetName(id), id);
SendClientMessage(playerid, COLOR_YELLOW, string);
SetPVarInt(id, "[A]Invite", 1);
SetPVarInt(id, "[A]Inviter", playerid);
return 1;
}
maybe because u add capital A
Re: zcmd Help. (2) -
Garry Roger - 31.03.2011
on my pawn i have error's undefine symbol GetName
and line 13 esnt close
Re: zcmd Help. (2) -
SchurmanCQC - 31.03.2011
..........................................
Stupidity these days.
Scroll down in the code in the original post.
pawn Код:
stock GetName(playerid)
{
new pName[24];
GetPlayerName(playerid, pName, sizeof(pName));
return pName;
}
Re: zcmd Help. (2) -
Garry Roger - 31.03.2011
sorry ima take a look now
Re: zcmd Help. (2) -
Garry Roger - 31.03.2011
dude is the aacc cmd is the only one not working
Re: zcmd Help. (2) -
SchurmanCQC - 31.03.2011
Don't double post, learn to use the edit button.
Respuesta: zcmd Help. (2) -
Alex_Obando - 31.03.2011
So...How to fix it?
Re: zcmd Help. (2) -
Scenario - 31.03.2011
The original code I gave you, located
here, most likely worked just fine. You did some editing on your own and changed the name of the "/ginvite" command to "/aacc". However, you did "/Aacc" for the command which is why it is not working properly, which was already pointed out on
this reply.
pawn Код:
#include <a_samp>
#include <zcmd>
native sscanf(const data[], const format[], {Float,_}:...);
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xA10000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
CMD:aacc(playerid, params[])
{
new id;
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, COLOR_RED, "You are not [A] Member");
if(sscanf(params, "u", id))
return SendClientMessage(playerid, COLOR_WHITE, "Wrong Player ID!");
new string[128];
format(string, sizeof(string), "%s(%d) has invited you to be [A] Do you Accept? /acceptinvite, or You decline? /declineinvite?", GetName(playerid), playerid);
SendClientMessage(id, COLOR_YELLOW, string);
format(string, sizeof(string), "You have invited %s(%d) to be an [A] Member.", GetName(id), id);
SendClientMessage(playerid, COLOR_YELLOW, string);
SetPVarInt(id, "[A]Invite", 1);
SetPVarInt(id, "[A]Inviter", playerid);
return 1;
}
CMD:acceptinvite(playerid, params[])
{
if(GetPVarInt(playerid, "[A]Invite") != 1)
return SendClientMessage(playerid, COLOR_RED, "Sorry, you haven't been Invited to be a Member.");
new pNewName[27];
format(pNewName, sizeof(pNewName), "[A]%s", GetName(playerid));
SetPlayerName(playerid, pNewName);
new string[128];
new id = GetPVarInt(playerid, "[A]Inviter");
format(string, sizeof(string), "%s(%d) has accepted your invite, %s is not an [A] Member.", GetName(playerid), playerid, GetName(playerid));
SendClientMessage(id, COLOR_GREEN, string);
format(string, sizeof(string), "You have accepted %s(%d)'s invite, You are now an [A] member, Welcome!", GetName(id), GetPVarInt(playerid, "[A]Inviter"));
SendClientMessage(playerid, COLOR_GREEN, string);
DeletePVar(playerid, "[A]Invite");
DeletePVar(playerid, "[A]Inviter");
return 1;
}
CMD:declineinvite(playerid, params[])
{
if(GetPVarInt(playerid, "[A]Invite") != 1)
return SendClientMessage(playerid, COLOR_RED, "Sorry, you haven't been invited to be [A]");
new string[128];
new id = GetPVarInt(playerid, "[A]Inviter");
format(string, sizeof(string), "%s(%d) has declined your invite!", GetName(playerid), playerid);
SendClientMessage(id, COLOR_RED, string);
format(string, sizeof(string), "You have declined %s(%d)'s invite, You won't be [A] Member Anymore.", GetName(id), GetPVarInt(playerid, "[A]Inviter"));
SendClientMessage(playerid, COLOR_RED, string);
DeletePVar(playerid, "[A]Invite");
DeletePVar(playerid, "[A]Inviter");
return 1;
}
stock GetName(playerid)
{
new pName[24];
GetPlayerName(playerid, pName, sizeof(pName));
return pName;
}
That should be fully working code. I do request that you add credits to who actually made that function inside of your script and if you have a /credits command that would be nice to add in there, as well.
Respuesta: Re: zcmd Help. (2) -
Alex_Obando - 31.03.2011
My Brother Just helped me, now...How to add this:
If I do /acceptinvite make the player administrator (level 5)