SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 07/01/2011, 01:23 AM   #1
Dainyzxz
Big Clucker
 
Dainyzxz's Avatar
 
Join Date: Apr 2007
Location: Lithuania
Posts: 110
Reputation: 0
Default Easy help for VIP

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:

Code:
	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
Dainyzxz is offline  
Old 07/01/2011, 01:32 AM   #2
John_F
Huge Clucker
 
John_F's Avatar
 
Join Date: Jul 2010
Posts: 244
Reputation: 0
Default Re: Easy help for VIP

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

**New COD server!**
Hosted list!
64.120.47.67:7777
Forum: www.cod-dm.com

Need scripting support or a person to script for you? PM me.
John_F is offline  
Old 07/01/2011, 01:42 AM   #3
Dainyzxz
Big Clucker
 
Dainyzxz's Avatar
 
Join Date: Apr 2007
Location: Lithuania
Posts: 110
Reputation: 0
Default Re: Easy help for VIP

first i need command code, than i will script for saving it and i'm not scripting with zcmd and sscanf
Dainyzxz is offline  
Old 07/01/2011, 01:57 AM   #4
John_F
Huge Clucker
 
John_F's Avatar
 
Join Date: Jul 2010
Posts: 244
Reputation: 0
Default Re: Easy help for VIP

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.
__________________

**New COD server!**
Hosted list!
64.120.47.67:7777
Forum: www.cod-dm.com

Need scripting support or a person to script for you? PM me.
John_F is offline  
Old 07/01/2011, 02:10 AM   #5
Dainyzxz
Big Clucker
 
Dainyzxz's Avatar
 
Join Date: Apr 2007
Location: Lithuania
Posts: 110
Reputation: 0
Default Re: Easy help for VIP

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
Dainyzxz is offline  
Old 07/01/2011, 02:15 AM   #6
admantis
High-roller
 
Join Date: Sep 2009
Posts: 2,524
Reputation: 449
Default Re: Easy help for VIP

pawn Code:
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;
        }
    }
admantis is offline  
Old 07/01/2011, 02:22 AM   #7
Haydz
Gangsta
 
Haydz's Avatar
 
Join Date: Jul 2010
Location: New Zealand
Posts: 752
Reputation: 44
Default Re: Easy help for VIP

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 Code:
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;
}
Haydz is offline  
Old 07/01/2011, 02:22 AM   #8
Dainyzxz
Big Clucker
 
Dainyzxz's Avatar
 
Join Date: Apr 2007
Location: Lithuania
Posts: 110
Reputation: 0
Default Re: Easy help for VIP

i will try, thanks man

i won't use zcmd any
Dainyzxz is offline  
Old 07/01/2011, 10:41 PM   #9
John_F
Huge Clucker
 
John_F's Avatar
 
Join Date: Jul 2010
Posts: 244
Reputation: 0
Default Re: Easy help for VIP

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.
__________________

**New COD server!**
Hosted list!
64.120.47.67:7777
Forum: www.cod-dm.com

Need scripting support or a person to script for you? PM me.
John_F is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 07:44 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.