Hi everyone. Please help me please and Thanks in Advance.
I've added some custom skins in my server and i want a script like ex. when player kills reach 100 then skin 201 unlocks and if player kills reach 200 then skin 202 unlock but i player kills are 0 then he can't spawn with 201 or 202 skin.
Thanks in Advance please Help me.
if(player.Score == 200) player.Skin = 201;
Quote from: Zone_Killer on Jul 15, 2017, 07:28 AMif(player.Score == 200) player.Skin = 201;
Oh please are you want to make me laugh? I have added custom skins in my server i don't want any player to choose them until they reach at 200 or 100 kills and then they can select the 201 or 202 skin from spawnscreen a message comes up "Skin 201 or 202 has been Unlocked you can choose that skin from Spawn screen"
Well Don't Know Much But I think it will work!
Add this
function onPlayerRequestSpawn( player )
{
if ( ( status[ player.ID ].Kills < 200 ) && ( player.Skin == 201 ) ) MessagePlayer( "Reach 200 Kills & get this Skin!", player );
else return 1;
}
Quote from: Terror_Styles on Jul 15, 2017, 08:57 AMWell Don't Know Much But I think it will work!
Add this
function onPlayerRequestSpawn( player )
{
if ( ( status[ player.ID ].Kills < 200 ) && ( player.Skin == 201 ) ) MessagePlayer( "Reach 200 Kills & get this Skin!", player );
else return 1;
}
Thanks Buddy :D
Quote from: Terror_Styles on Jul 15, 2017, 08:57 AMWell Don't Know Much But I think it will work!
Add this
function onPlayerRequestSpawn( player )
{
if ( ( status[ player.ID ].Kills < 200 ) && ( player.Skin == 201 ) ) MessagePlayer( "Reach 200 Kills & get this Skin!", player );
else return 1;
}
the index 'status' does not exist]
Bro I added that because there must be already a Array of PlayerStats
I know he is not adding it in a Blank Script.
Grow Up!
onplayerspawn( player )
{
if( Stats[player.ID].Kills >= 200 ) player.Skin = 201; MessagePlayer("sexi",player)
else if( Stats[player.ID].Kills >= 200 ) player.Skin = 202; MessagePlayer("sexi x2",player)
else if( Stats[player.ID].Kills >= 300 ) player.Skin = 203; MessagePlayer("sexi x3",player)
else if( Stats[player.ID].Kills >= 400 ) player.Skin = 204; MessagePlayer("sexi x4",player)
else if( Stats[player.ID].Kills >= 500 ) player.Skin = 205; MessagePlayer("sexi x5",player)
else if( Stats[player.ID].Kills >= 600 ) player.Skin = 206; MessagePlayer("sexi x6",player)
else if( Stats[player.ID].Kills >= 700 ) player.Skin = 207; MessagePlayer("sexi x7",player)
else if( Stats[player.ID].Kills >= 800 ) player.Skin = 208; MessagePlayer("sexi x8",player)
else if( Stats[player.ID].Kills >= 900 ) player.Skin = 209; MessagePlayer("sexi x9",player)
else if( Stats[player.ID].Kills >= 1000 ) player.Skin = 210; MessagePlayer("sexi x10",player)
}
Stats, pstats,status, stats
if you no have Database use
if(player.Score == 100) and bla bla bla + code player.Skin = bla and funcion message
Here is the Full Code If you wanna use it In Your Script
First of All we Need Classes for Kills
class PlayerStats
{
Kills = 0;
}
Then Load an Array onScriptLoad
function onScriptLoad()
{
status <- array(GetMaxPlayers(), null);
}
Then Add this on your PlayerJoin to Load Stats
function onPlayerJoin( player )
{
status[player.ID] = PlayerStats();
}
At Last Add this Onyour Request Spawn to Prevent user from spawning with
Custom Special Skin
function onPlayerRequestSpawn( player )
{
if ( ( status[ player.ID ].Kills < 200 ) && ( player.Skin == 201 ) ) MessagePlayer( "Reach 200 Kills & get this Skin!", player );
else return 1;
}
Happy Coding!
@Zone_Killer @kennedyarz
Happy Coding! ??? wut? i never request you help ???
Quote from: kennedyarz on Jul 16, 2017, 02:51 PMHappy Coding! ??? wut? i never request you help ???
You just posted a code in a reply Which make nosense & He Didn't ask for that too :P So I mentioned you there to tell you What Actually He Wanted!
:P
SqCore.On().PlayerRequestSpawn.Connect(function (player, offset)
{
if
(
(player.Kills < 100 && player.Skin == 201) ||
(player.Kills < 200 && player.Skin == 202)
)
SqCore.SetState(0);
});
Good idea