SA-MP Forums Archive
not spawn Don't use command - 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)
+--- Thread: not spawn Don't use command (/showthread.php?tid=589459)



not spawn Don't use command - Harward - 19.09.2015

Please, The player without spawn , Don't use command and And you have to be logged in to spawn.

So = Login = 0, Don't spawn. - Login = 1, Yes Spawn.
So = Spawn = 0, Don't use command. - Spawn = 1, Yes use command.



Re: not spawn Don't use command - Andre02 - 19.09.2015

Use if and else statements and a enum for this
- https://sampwiki.blast.hk/wiki/Control_Structures#if
- https://sampwiki.blast.hk/wiki/Control_Structures#else
- https://sampwiki.blast.hk/wiki/Keywords:Initialisers#enum

Here, I did this for you.
This is the code with some missing things, you will have to read the links above and find out what is missing, this will help you out learning how to do this kind of functions:

pawn Код:
// On the top of your script

enum spawnInfo
{
    IsSpawned,
    // Something missing here
};
new sInfo[MAX_PLAYERS][spawnInfo];

// --------------------------------

public OnPlayerSpawn(playerid)
{
    if (sInfo[playerid][IsLogged] == 0)
    {
        TogglePlayerControllable(playerid, 1);
    }
        // Something missing here
    {
        sInfo[playerid][IsSpawned] = 1; // Something missing here
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    sInfo[playerid][IsSpawned] = ; // Something missing here
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (  ) // Something missing here
    {
        SendClientMessage(playerid, 0xFF0000FF, "[ERROR] You can not use any command if you are not spawned.");
    }
    return 1;
}