SA-MP Forums Archive
This topic has been [SOLVED] - 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: This topic has been [SOLVED] (/showthread.php?tid=147654)



This topic has been [SOLVED] - Jay. - 13.05.2010

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.


Re: How to lock a skin for a certain "Playername" - juice.j - 13.05.2010

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.


Re: How to lock a skin for a certain "Playername" - Killa_ - 13.05.2010

https://sampwiki.blast.hk/wiki/How_to_pa..._protect_skins


Re: How to lock a skin for a certain "Playername" - Jay. - 13.05.2010

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



Re: How to lock a skin for a certain "Playername" - Jay. - 13.05.2010

Quote:
Originally Posted by Killa_
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").


Re: How to lock a skin for a certain "Playername" - juice.j - 13.05.2010

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



Re: How to lock a skin for a certain "Playername" - Jay. - 13.05.2010

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.


Re: How to lock a skin for a certain "Playername" - juice.j - 13.05.2010

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



Re: How to lock a skin for a certain "Playername" - Jay. - 13.05.2010

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.


Re: How to lock a skin for a certain "Playername" - Jay. - 13.05.2010

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.?