not spawed - 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 spawed (
/showthread.php?tid=339504)
not spawed -
oscar7610 - 03.05.2012
players are typing a cmd when they arent even spawned!!
How can I disable that And make something like.
"Please spawn before typing a command"
And you disable the cmds.
Re: not spawed -
ViniBorn - 03.05.2012
Use booleans ...
Re: not spawed -
oscar7610 - 03.05.2012
Can you give me an example? il rep you dw.
Im new into scripting.
Re: not spawed -
ViniBorn - 03.05.2012
pawn Код:
new bool:Commands[MAX_PLAYERS];
//OnPlayerConnect
Commands[playerid] = false;
//OnPlayerSpawn
Commands[playerid] = true;
//OnPlayerCommandText
if(!Commands[playerid])
return SendClientMessage(playerid,-1,"Please spawn before typing a command");
Re: not spawed -
HDFord - 03.05.2012
use IsPlayerLoggedIn on the commands, if you have a login/register system
Re: not spawed -
Revo - 03.05.2012
pawn Код:
new bool:isspawned[MAX_PLAYERS]; //Create a variable that stores whether the player is spawned or not.
pawn Код:
OnPlayerCommandText(playerid, cmdtext[])
{
if(isspawned[playerid]) //Is the player spawned?
{
//commands
return 1;
}
else return SendClientMessage(playerid, 0xFFFFFFAA, "Please spawn before using this command."); //Return that the player has to spawn if not.
}
pawn Код:
OnPlayerSpawn(playerid)
{
isspawned[playerid] = true; //If the player spawns, the value is set to true.
return 1;
}
OnPlayerDeath(playerid)
{
isspawned[playerid] = false; //If the player dies/despawn, the value is set to false.
return 1;
}
OnPlayerDisconnect(playerid, reason)
{
isspawned[playerid] = false; //If the player dies/despawn, the value is set to false.
return 1;
}
Should give you some idea of what to do.
Re: not spawed -
2KY - 03.05.2012
pawn Код:
new CanUseCommands [ MAX_PLAYERS ] = 0;
OnPlayerConnect:
pawn Код:
CanUseCommands [ playerid ] = 0;
OnPlayerCommandText:
pawn Код:
if( CanUseCommands [ playerid ] != 1 ) return false; // Put the rest of your commands under it!
OnPlayerDeath:
pawn Код:
CanUseCommands[ playerid ] = 0;
OnPlayerSpawn:
pawn Код:
CanUseCommands [ playerid ] = 1;
Edit: Beat me to it.
Re: not spawed -
oscar7610 - 03.05.2012
Quote:
Originally Posted by Viniborn
pawn Код:
new bool:Commands[MAX_PLAYERS];
//OnPlayerConnect Commands[playerid] = false;
//OnPlayerSpawn Commands[playerid] = true;
//OnPlayerCommandText if(!Commands[playerid]) return SendClientMessage(playerid,-1,"Please spawn before typing a command");
|
rep you thanks worked.
Re: not spawed -
oscar7610 - 03.05.2012
They still can talk not a command but still can talk when not spawned.
Re: not spawed -
oscar7610 - 03.05.2012
Quote:
Originally Posted by 2KY
pawn Код:
new CanUseCommands [ MAX_PLAYERS ] = 0;
OnPlayerConnect:
pawn Код:
CanUseCommands [ playerid ] = 0;
OnPlayerCommandText:
pawn Код:
if( CanUseCommands [ playerid ] != 1 ) return false; // Put the rest of your commands under it!
OnPlayerDeath:
pawn Код:
CanUseCommands[ playerid ] = 0;
OnPlayerSpawn:
pawn Код:
CanUseCommands [ playerid ] = 1;
Edit: Beat me to it.
|
Thanks for helping me rep u.