19.09.2015, 14:13
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:
- 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;
}