This topic has been [SOLVED]
#1

Hey guy's erm, I wanna lock a skin for only me. my ingame name is "Jay"

And i wanna lock a skin so like other players can not spawn with it, and a message like "SendClientMessage(playerid,COLOR,"This skin is for Jay only");


Please reply if you can help thanks alot.
Reply
#2

Check the example of this wiki article out:

https://sampwiki.blast.hk/wiki/OnPlayerRequestClass

Instead of comparing the admin level in an if-clause you could just compare the player name for instance.
Reply
#3

https://sampwiki.blast.hk/wiki/How_to_pa..._protect_skins
Reply
#4

Quote:
Originally Posted by juice.j
Check the example of this wiki article out:

https://sampwiki.blast.hk/wiki/OnPlayerRequestClass

Instead of comparing the admin level in an if-clause you could just compare the player name for instance.

Sorry, I've checked that article but i'm a beginner scripter. So maybe you can give me a example code.?


And i don't know how to make it for a playername
Reply
#5

I'm not looking for a password but thanks anyway.


I want it to lock a Certain skin ID for the nick "Jay"

And returns a message like. ("Sorry this skin is reserved for Jay").
Reply
#6

Alright,

you can pretty much use the example as it is, however you change this line here:

Код:
if(classid == 3 && !IsPlayerAdmin(playerid))
to the classid you actually want to have only reserved for yourself, let's say it's the 5th, and the second clause to comparing your name:

Код:
new cmpstr[MAX_PLAYER_NAME];
GetPlayerName(playerid, cmpstr, sizeof(cmpstr));
if(classid == 5 && strcmp(cmpstr,"Jay",false))    //classid == 5 as you want to reserve the fifth classid
The whole code then would look like:

Код:
public OnPlayerRequestClass(playerid,classid)
{
  new cmpstr[MAX_PLAYER_NAME];
  GetPlayerName(playerid, cmpstr, sizeof(cmpstr));
  if(classid == 5 && strcmp(cmpstr,"Jay",false))
  {
    SendClientMessage(playerid,COLOR_GREEN,"This skin is only for Jay!");
    return 0;
  }
  return 1;
}
Reply
#7

Quote:
Originally Posted by juice.j
Alright,

you can pretty much use the example as it is, however you change this line here:

Код:
if(classid == 3 && !IsPlayerAdmin(playerid))
to the classid you actually want to have only reserved for yourself, let's say it's the 5th, and the second clause to comparing your name:

Код:
new cmpstr[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(classid == 5 && strcmp(name,"Jay",false))    //classid == 5 as you want to reserve the fifth classid
The whole code then would look like:

Код:
public OnPlayerRequestClass(playerid,classid)
{
  new cmpstr[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, sizeof(name));
  if(classid == 5 && strcmp(name,"Jay",false))
  {
    SendClientMessage(playerid,COLOR_GREEN,"This skin is only for admins!");
    return 0;
  }
  return 1;
}
Okay, I will give this a try and thanks for the short tut.

Then are tell you if it complied succesfully.
Reply
#8

Hang on I pasted it a bit in a rush, there are some errors, use the edited one here:

Код:
public OnPlayerRequestClass(playerid,classid)
{
  new cmpstr[MAX_PLAYER_NAME];
  GetPlayerName(playerid, cmpstr, sizeof(cmpstr));
  if(classid == 5 && strcmp(cmpstr,"Jay",false))
  {
    SendClientMessage(playerid,COLOR_GREEN,"This skin is only for Jay!");
    return 0;
  }
  return 1;
}
Reply
#9

Quote:
Originally Posted by juice.j
Hang on I pasted it a bit in a rush, there are some errors, use the edited one here:

Код:
public OnPlayerRequestClass(playerid,classid)
{
  new cmpstr[MAX_PLAYER_NAME];
  GetPlayerName(playerid, cmpstr, sizeof(cmpstr));
  if(classid == 5 && strcmp(cmpstr,"Jay",false))
  {
    SendClientMessage(playerid,COLOR_GREEN,"This skin is only for Jay!");
    return 0;
  }
  return 1;
}

Aha, So thats why i had errors are try this now ty.
Reply
#10

Thank you very much juice_j.


Complied succesfully.

But 1 question:


(This line if(classid == 5 && strcmp(cmpstr,"Jay",false)) The classid "5" is this The ID Of the skin or the row down. Like


example

Код:
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(673, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(289, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(285, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(92, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);//line 5 this would be locked.?

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)