Make VIP command only?
#1

I wanna make /laseron a VIP only command. This is an example of a VIP feature, how do i make vip only commands tho? thanks...

Код:
if(PlayerInfo[playerid][pVIP] > 0)
	    {
	    	new Float:armour, level;
			GetPlayerArmour(playerid, armour);
	        level = PlayerInfo[playerid][pVIP];
	        switch(level)
	        {

	            case 1:
	            {
	                SetPlayerArmour(playerid, 50.0);
	                SendClientMessage(playerid, C_GREY, "** VIP armour added!");
				}
				case 2:
				{
				    SetPlayerArmour(playerid, 99);
				    SendClientMessage(playerid, C_GREY, "** VIP armour added!");
				}
				case 3:
				{
				    SetPlayerArmour(playerid, 99);
				    SendClientMessage(playerid, C_GREY, "** VIP armour added!");
				}
			}
		}

		SetRank3DText(playerid);
	}
	else
 	{
		TogglePlayerControllable(playerid, 0);
	    SetPlayerClass(playerid);
	}
	return 1;
}
Reply
#2

This is the way of making a specified command for VIP

pawn Код:
CMD:laseron(playerid,params[]){
    #pragma unused params
    if(PlayerInfo[playerid][pVIP] >= 1)
    {
        //codes
    }
    else
    {
        SendClientMessage(playerid,-1,"Sorry, you are not a VIP and cannot use this feature.");
    }
    return 1;}
Reply
#3

I used this code:
Код:
CMD:laseron(playerid, params[])
{
    if(PlayerInfo[playerid][pVIP] > 1)
		{
	SetPVarInt(playerid, "laser", 1);
 	SetPVarInt(playerid, "color", GetPVarInt(playerid, "color"));

 	else
    {
        SendClientMessage(playerid,-1,"Sorry, you are not a VIP and cannot use this feature.");
    }
  	return 1;}
}
But I get 1 error and 1 warning:
Код:
C:\Users\tommy\Desktop\Battlefield Server 1.8\gamemodes\battlefield.pwn(4148) : error 029: invalid expression, assumed zero
C:\Users\tommy\Desktop\Battlefield Server 1.8\gamemodes\battlefield.pwn(4153) : warning 209: function "cmd_laseron" should return a value
Reply
#4

pawn Код:
CMD:laseron(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][pVIP]  < 1) return SendClientMessage(playerid, -1,"This command is restricted for the VIPs only.");
    SetPVarInt(playerid, "laser", 1);
    SetPVarInt(playerid, "color", GetPVarInt(playerid, "color"));
    return 1;
}
Reply
#5

C:\Documents and Settings\S0n\Desktop\vip.pwn(9) : warning 203: symbol is never used: "laseron"
C:\Documents and Settings\S0n\Desktop\vip.pwn(9) : error 013: no entry point (no public functions)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#6

U don't need pragma unused params with ZCMD, it's only needed for dcmd.
Reply
#7

mate, if it says symbol is never used: laseron, then i think you havent got the zcmd include right?

do you have on top of your script:
pawn Код:
#include <zcmd>
?

and do you also actaully HAVE the include in your includes folder?

also use [code.] and [/code.] with out the . , so you can put the things like i did in a special part of your text.

greets niels
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)