Easy help for VIP
#1

hey all, i'm creating VIP sistem and i need only one thing

i have this

new VIP[MAX_PLAYERS];
if(VIP[playerid] == 1)



at the moment i'm using this command:

Код:
	if (strcmp(cmd, "/duotivip", true) == 0 || strcmp(cmd, "/vipon", true) == 0)
	{
	if(VIP[playerid] == 1)
	{
	SendClientMessage(playerid, COLOR_SYSTEM, "You're already VIP!");
	}
	else
	{
	VIP[playerid] = 1;
	SendClientMessage(playerid, COLOR_SYSTEM, "Now you have VIP!");
	}
	return 1;
	}

	if (strcmp(cmd, "/atimtivip", true) == 0 || strcmp(cmd, "/vipoff", true) == 0)
	{
	if(VIP[playerid] == 0)
	{
	SendClientMessage(playerid, COLOR_SYSTEM, "You're not VIP!");
	}
	else
	{
	VIP[playerid] = 0;
	SendClientMessage(playerid, COLOR_SYSTEM, "Your VIP gone!");
	}
	return 1;
	}
but i need something like: /vipon [id] /vipoff [id]

how i can make what i could make other VIP's with command? please help


PROBLEM:

Need /give vip [id] function ar something like this
Reply
#2

I suggest you use:
.dini to save a player's VIP level
ZCMD and SSCANF to make /givevip commands
Reply
#3

first i need command code, than i will script for saving it and i'm not scripting with zcmd and sscanf
Reply
#4

I'm not saying you are using zcmd and sscanf, i'm saying you should.
As for this, it's quite easy to save and get info using .dini
When the player logs in:
set their VIP level to the 1 in their user file
When an admin does /givevip change the value in their user file.
Then you're done.
Reply
#5

no, i don't need any saving now, i just need to set "VIP[playerid] = 1" for other player with command /setvip [id]

like sending moneys, but now it's need to send "VIP[playerid] = 1" for him
Reply
#6

pawn Код:
if(strcmp("/makevip", cmd, true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            tmp = strtok(cmdtext,idx);
            if(!strlen(tmp))
            {
                return SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /makevip [id]");
            }
            new id = strval(tmp);
            new pid = playerid;
            if(!IsPlayerConnected(id))
            {
                return SendClientMessage(playerid,COLOR_GRAY,"AdmCmd: This player is not online!");
            }
           
            new victimid[MAX_PLAYERS];
            new amsg[60];
            GetPlayerName(id, victimid, sizeof(victimid));
            format(amsg,sizeof(amsg),"AdmCmd: You have made %s a VIP User.",victimid);
            SendClientMessage(pid,COLOR_LIGHTBLUE,amsg);
            SendClientMessage(id,COLOR_YELLOW,"You're now a golden user.");
            VIP[id] = 1;
            return 1;
        }
        else
        {
            SendClientMessage(playerid,COLOR_GRAY,"You don't have authorization.");
            return 1;
        }
    }
Reply
#7

or if you want ZCMD, you would have to add your admin level system to this command if you wanted only admins to do it.

pawn Код:
COMMAND:givevip(playerid, params[]) //the command
{
    new giveplayerid,pName[24],gName[24],string[100];
    if(sscanf(params, "d", giveplayerid))return SendClientMessage(playerid, 0xFFFFFFFF, "/givevip [playerid/name]");
    else if(!IsPlayerConnected(giveplayerid))return SendClientMessage(playerid, 0xFF0000FF, "Player is not connected");
    else
    {
        GetPlayerName(playerid, pName,24);
        GetPlayerName(giveplayerid,gName,24);
        VIP[giveplayerid] = 1;
        format(string, sizeof(string),"You gave player %s VIP",gName);
        SendClientMessage(playerid,0xFFFFFFAA,string);
        SendClientMessage(giveplayerid,0xFFFFFFAA,"You are now a VIP player");
    }
    return 1;
}
Reply
#8

i will try, thanks man

i won't use zcmd any
Reply
#9

Why are you so against the usage of zcmd?
It's a faster command interface which is easier to implement than strcmp and allows for the usage of parameters quite easily.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)