31.03.2011, 00:53
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
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;
}