05.11.2012, 11:31
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.
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:
Now put this in the public OnPlayerTextCommand:
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.
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.
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];
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
Code:
dcmd(setvip, 6, cmdtext);
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; } }
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.