Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

On player connect, give player variables

$
0
0
So I would like to give a player the pAdmin variable, which is under my enum. When the player with the name "JXF" would connect, I would like the server to give him the pAdmin variable with the level 1338. How would I manage to do that?

Here's my strcmp code:
Code:

forward NameJXF(playerid);
public NameJXF(playerid)
{
        if(IsPlayerConnected(playerid))
        {
                new nume[24];
                GetPlayerName(playerid, nume, sizeof(nume));
                if((strcmp(nume, "JXF", true) == 0))
                {
                        return 1;
                }
        }
        return 0;
}

EDIT:
I have tried to do the On player connect to give player variables with SetPVarInt
This is my code:
Code:

public OnPlayerConnect(playerid)
{
    if(NameJXF(playerid))
        {
                new string[128];
                format(string, sizeof(string), "You have been given full administrator rights, master!");
                SCM(pid, COLOR_AQUA, string);
                SetPVarInt(playerid, Player[playerid][pAdmin], 1339);
        }

IT does compile, but it doesn't work properly. What is the issue here?
P.S I have never used setpvarint ever before.

Viewing all articles
Browse latest Browse all 18226

Trending Articles