SA-MP Forums Archive
VIP Check - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: VIP Check (/showthread.php?tid=186103)



How do i check this? - corne - 27.10.2010

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"
};



Re: VIP Check - Jeffry - 27.10.2010

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.


Re: VIP Check - corne - 27.10.2010

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;


Re: VIP Check - Jeffry - 27.10.2010

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.