Could This Script Work?
#1

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?
Reply
#2

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.
Reply
#3

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?
Reply
#4

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;
}
Reply
#5

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?
Reply
#6

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
Reply
#7

I want it to check if its HayZatic picking Skin id.

I only want HayZatic To Pick That Skin
Reply
#8

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.
Reply
#9

After All of this, It finally worked! Thanks Guys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)