Could This Script Work? -
HayZatic - 05.07.2011
So i jotted down some ideas and thought about making a script that i had no info, or background image about! So hes the code.
Код:
SetupPlayerForClassSelection(playerid);
new skin = GetPlayerSkin(playerid);
if(skin == 117)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
if(strcmp( Name, "HayZatic"))
{
SendClientMessage(playerid, RED, "Welcome HayZatic");
}
else
{
GameTextForPlayer(playerid, "Only For HayZatic!", 5000, 5);
return 0;
}
}
return 1;
I Compiled No Errors, but it seems like when i go into game the skin dosnt appear! Why?
Re: Could This Script Work? -
Bakr - 05.07.2011
You're using a custom function, SetupPlayerForClassSelection. I'm assuming you want to apply this code for when the player presses the Spawn button? If so, you should place this code under the OnPlayerRequestSpawn callback.
Re: Could This Script Work? -
HayZatic - 05.07.2011
Quote:
Originally Posted by Bakr
You're using a custom function, SetupPlayerForClassSelection. I'm assuming you want to apply this code for when the player presses the Spawn button? If so, you should place this code under the OnPlayerRequestSpawn callback.
|
I Tried This And it did the Same Same Thing as the First Callback still, any ideas? Do you want me to paste the script for you to see?
Re: Could This Script Work? -
Snipa - 05.07.2011
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if(classid == 117) //Whichever classid the skin is
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
if(strcmp( Name, "HayZatic", false))
{
SendClientMessage(playerid, RED, "Welcome HayZatic");
}
else
{
GameTextForPlayer(playerid, "Only For HayZatic!", 5000, 5);
return 0;
}
}
return 1;
}
Re: Could This Script Work? -
Bakr - 05.07.2011
Sorry, I misread your code. Are you placing this code under the OnPlayerRequestClass callback? If not, do so.
And is it the skin or classid that you want to check?
Re: Could This Script Work? -
cessil - 05.07.2011
I believe he's adding it to OnPlayerConnect since he has the
SendClientMessage(playerid, RED, "Welcome HayZatic");
which is also wrong, getting a players skin onplayerconnect will return 0 since they only get a skinid OnPlayerRequestClass
Re: Could This Script Work? -
HayZatic - 05.07.2011
I want it to check if its HayZatic picking Skin id.
I only want HayZatic To Pick That Skin
Re: Could This Script Work? -
Bakr - 05.07.2011
Once again, you'll need to place that code into the OnPlayerRequestClass callback.
P.S. You'll also need to change this line:
pawn Код:
if(strcmp( Name, "HayZatic"))
To this
pawn Код:
if(!strcmp( Name, "HayZatic"))
Like as I described before, strcmp returns 0 when the arguments match.
Re: Could This Script Work? -
HayZatic - 05.07.2011
After All of this, It finally worked! Thanks Guys!