VIP Check
#1

How to check in

Код:
	if (strcmp(cmd, "/vip", true) == 0)
	{
		if(IsPlayerAdmin(playerid))
		{
		    tmp = strtok(cmdtext, idx);
		    new what[8];
		    strmid(what, tmp, false, strlen(cmdtext), 8);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREY, "USAGE: /vip [Password]");
				return 1;
			}

	    	if(strcmp(what, "thgLLXT1", true, strlen(what)) == 0)
			{
			    //Here the check if Playername is vip?
			}
		}
	}
if the username is vip, Usernames are standing here:
Код:
new Vips[2][1] =
{
    "Username1",
    "Username2"
};
Reply
#2

First:

pawn Код:
new Vips[2][MAX_PLAYER_NAME] =
{
    "Username1",
    "Username2"
};
Add this at bottom of your code:
pawn Код:
stock IsPlayerVIP(playerid)
{
    new PlName[MAX_PLAYER_NAME]; GetPlayerName(playerid, PlName, MAX_PLAYER_NAME);
    for(new i=0; i<sizeof(Vips); i++) if(!strcmp, PlName, Vips[i]) return 1;
    return 0;
}
pawn Код:
if(strcmp(what, "thgLLXT1", true, strlen(what)) == 0 && IsPlayerVIP(playerid))
            {
                //Here what you want to make if VIP logged in.
            }
Hope it works.
Reply
#3

C:\Documents and Settings\Corne\Bureaublad\One2xs\gamemodes\one2xs. pwn(48 : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Line 488: for(new i=0; i<sizeof(Vips); i++) if(!strcmp, PlName, Vips[i]) return 1;
Reply
#4

pawn Код:
stock IsPlayerVIP(playerid)
{
    new PlName[MAX_PLAYER_NAME]; GetPlayerName(playerid, PlName, MAX_PLAYER_NAME);
    for(new i=0; i<sizeof(Vips); i++) if(!strcmp(PlName, Vips[i])) return 1;
    return 0;
}
Woops, my fault. MissTyped myself. ^^

This should do it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)