VIP Skin Problem

Started by [VM_U]Spectra.PhantoM^, Dec 27, 2015, 03:45 AM

Previous topic - Next topic

[VM_U]Spectra.PhantoM^

ok i added vip skin in my server that has cool custom weapons and all the benefits of vip but.... all people(NOT VIP) can spawn in that skin. can anyone give me a restriction code that when a player below lvl 2 tries to spawn in that skin he will get auto killed?

Thanx
Wanna Talk To Me? Come At Irc #Jugo@LUNet

Xmair

function onPlayerSpawn( player )
{
if ( player.Skin == YourSkinHere )
{
if ( GetLevel( player ) >= 2 )
{
//You can do your vip stuffs here.
}
else
{
player.Health=0.00;
MessagePlayer("You need to be atleast level 2!",player);
}
}
}
Untested.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

[VM_U]Spectra.PhantoM^

Quote from: Xmair on Dec 27, 2015, 04:27 AMfunction onPlayerSpawn( player )
{
if ( player.Skin == YourSkinHere )
{
if ( GetLevel( player ) >= 2 )
{
//You can do your vip stuffs here.
}
else
{
player.Health=0.00;
MessagePlayer("You need to be atleast level 2!",player);
}
}
}
Untested.
Player can still spawn in that skin.......
Wanna Talk To Me? Come At Irc #Jugo@LUNet

.

FFS, can't you just:

local g_SkinLevels = array(160 /* 160 skin ids */, 1 /* all skins have level 1 by default */);

/* skin id 0 = tommy vercetti */
g_SkinLevels[0] = 10; /* level 10 */
/* skin id 1 = cop */
g_SkinLevels[1] = 3; /* level 3 */
/* skin id 2 = swat */
g_SkinLevels[2] = 6; /* level 6 */
/* skin id 3 = fbi */
g_SkinLevels[3] = 7; /* level 7 */

/* -> reproduce for every skin id... */

function GetPlayerLevel(player)
{
    return -1; /* *.poof.* MAGIC! */
}

function onPlayerRequestSpawn(player)
{
    if (GetPlayerLevel(player) < g_SkinLevels[player.Skin])
    {
        /* MessagePlayer("Your level is too low for this skin fool!") */
        return false; /* CANNOT SPAWN! */
    }

    return true; /* CAN SPAWN! */
}
.

[VM_U]Spectra.PhantoM^

Quote from: S.L.C on Dec 27, 2015, 05:05 AMFFS, can't you just:

local g_SkinLevels = array(160 /* 160 skin ids */, 1 /* all skins have level 1 by default */);

/* skin id 0 = tommy vercetti */
g_SkinLevels[0] = 10; /* level 10 */
/* skin id 1 = cop */
g_SkinLevels[1] = 3; /* level 3 */
/* skin id 2 = swat */
g_SkinLevels[2] = 6; /* level 6 */
/* skin id 3 = fbi */
g_SkinLevels[3] = 7; /* level 7 */

/* -> reproduce for every skin id... */

function GetPlayerLevel(player)
{
    return -1; /* *.poof.* MAGIC! */
}

function onPlayerRequestSpawn(player)
{
    if (GetPlayerLevel(player) < g_SkinLevels[player.Skin])
    {
        /* MessagePlayer("Your level is too low for this skin fool!") */
        return false; /* CANNOT SPAWN! */
    }

    return true; /* CAN SPAWN! */
}
where do i add the g_skinlevels dou(though)?
Wanna Talk To Me? Come At Irc #Jugo@LUNet

KAKAN

#5
Quote from: {ultimatejugo] on Dec 27, 2015, 05:35 AM
Quote from: S.L.C on Dec 27, 2015, 05:05 AMFFS, can't you just:
...
where do i add the g_skinlevels dou(though)?
You won't understand anything, add it here in this way:-

function onScriptLoad(){
g_SkinLevels <- array(160,1);
}

@S.L.C He can't make that too.
@ultimate here's one for you, the one which you can understand:-
function onPlayerRequestSpawn( player ){
local id = 0; //Insert your skin id here.
local rlevel = 2; //Insert the minimum required level for it.
if( GetLevel( player ) < rlevel && player.Skin == id ) return 0;
else return 1;
//Replace GetLevel with your function.
}
oh no

Anik

Why not use database??? Add the player's name in DB. And use that.

jayant

Quote from: Anik on Dec 29, 2015, 02:15 PMWhy not use database??? Add the player's name in DB. And use that.
Yes we are using database,in the database we check a user's level and if its the required level we allow the user to spawn with the vip skin.You can conclude from the below and above code.
function Getlvl(player)
{
 local lvl = GetSQLColumnData( QuerySQL( db, "SELECT Level FROM Accounts WHERE Name='" + player.Name + "'" ), 0 );
 if ( lvl ) return lvl;
 else return 0;
}
function Getlvltag(player)
{
 local lvl = Getlvl(player);
 if ( lvl == 1 ) return "User";
 if ( lvl == 8 ) return "Moderator";
 if ( lvl == 9 ) return "Admin";
 if ( lvl == 10 ) return "Head-Admin";
 if ( lvl == 20 ) return "Developer";
 if ( lvl == 0 ) return "Guest";
}

KAKAN

Quote from: Anik on Dec 29, 2015, 02:15 PMWhy not use database??? Add the player's name in DB. And use that.
What u mean?
What the hell you want to add in DB?
Just add a level check, that's much simpler than this :)
oh no

Anik

Quote from: KAKAN on Dec 29, 2015, 05:02 PM
Quote from: Anik on Dec 29, 2015, 02:15 PMWhy not use database??? Add the player's name in DB. And use that.
What u mean?
What the hell you want to add in DB?
Just add a level check, that's much simpler than this :)
He is making something like donate system. So if any play who have not not donated but is admin in the server will be able to spawn with that skin. And if he use GetLevel then the player who has donated, He needs to give level to the player. In this case, he can store the names of the donators in DB. And add a check.

KAKAN

Quote from: Anik on Dec 30, 2015, 07:48 AM
Quote from: KAKAN on Dec 29, 2015, 05:02 PM
Quote from: Anik on Dec 29, 2015, 02:15 PMWhy not use database??? Add the player's name in DB. And use that.
What u mean?
What the hell you want to add in DB?
Just add a level check, that's much simpler than this :)
He is making something like donate system. So if any play who have not not donated but is admin in the server will be able to spawn with that skin. And if he use GetLevel then the player who has donated, He needs to give level to the player. In this case, he can store the names of the donators in DB. And add a check.
Why not to use level for that?
if( player.Level() == 2 ) //If player is VIP
{
//Do shits here!
}
oh no