[Tutorial] How to create a Simple VIP system.
#1

Off-Topic

After a long time, i decided to create a new Tutorial. I was 'browsing' trough the 'Useful Tutorials' topic and saw no Tutorial about VIP. I know that here on this Forums are Tutorials about VIP system, but they may be old, so that's why i am here.

Introduction
I'll be making a Simple VIP system with no levels. I think that levels aren't needed, that's just my opinion . Lets begin.

enum
I'll use enum instead of new or something else, i use enums when i can, so why not here.

Code:
enum PlayerInfo
{
    IsPlayerVIP
};
new pInfo[MAX_PLAYERS][PlayerInfo];
The Command 1.0
We'll use only one Command, not two. Some people use: /setvip, /unsetvip or something similliar to that. I forgot to say that i'll use DCMD in this Tutorial. Put this on the Top of the Script:

Code:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Now put this in the public OnPlayerTextCommand:

Code:
dcmd(setvip, 6, cmdtext);
The Command 1.1
Now, it's time to trigger something. When the player types /setvip, we'll have to check if he's RCON Admin, if the player he entered is online and set the player's VIP status to true.

Code:
dcmd_setvip(playerid, params[])
{
    if(pInfo[playerid][IsPlayerVIP] == 0)
    {
        new ID = strval(params);
        new PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        new string[128];
        if(!IsPlayerAdmin)) return SendClientMessage(playerid, -1, "{FF0000}You need to be an RCON Administrator.");
        if (!strlen(params)) return SendClientMessage(playerid,  -1, "{FF0000}Usage: /setvip [PlayerID]");
        else if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,  -1, "{FF0000}That player isn't connected.");
        else
        {
            format(string, sizeof(string), "Staff member %s has set %s to a VIP.", PlayerName(playerid), PlayerName(ID));
            SendClientMessageToAll(-1, string);
            pInfo[playerid][IsPlayerVIP] = 1;
        }
        return 1;
    }
    else
    {
        pInfo[playerid][IsPlayerVIP] = 0;
    }
}
Alright. We're done. I made this in School (lol) because i'm bored. I hope you'll like my Tutorial and i hope it will help you to become a Great Pawner!

NOTICE: If you find any Errors, warnings or you can't understand something well, ask me. If i did any mistake please inform me so i can repair it.
Reply
#2

Bringing your old topic back to life

Code:
C:\Users\Karl\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(719) : error 017: undefined symbol "cmdtext"
C:\Users\Karl\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(719) : error 029: invalid expression, assumed zero
C:\Users\Karl\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(719) : warning 215: expression has no effect
C:\Users\Karl\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(719) : error 001: expected token: ";", but found "]"
C:\Users\Karl\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(719) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#3

i just wanna know about saving a player as VIP
in scriptfiles
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)