zcmd Help. (2)
#1

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;
}
Reply
#2

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
Reply
#3

on my pawn i have error's undefine symbol GetName
and line 13 esnt close
Reply
#4

..........................................

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;
}
Reply
#5

sorry ima take a look now
Reply
#6

dude is the aacc cmd is the only one not working
Reply
#7

Don't double post, learn to use the edit button.
Reply
#8

So...How to fix it?
Reply
#9

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.
Reply
#10

My Brother Just helped me, now...How to add this:


If I do /acceptinvite make the player administrator (level 5)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)