onplayerconnect question
#1

hello, does any one know how to prevent people from talking unless they spawn? , like onplayerconnect make player not able to talk or send pm intill th ey SPAWN?
Reply
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(!IsPlayerConnected(playerid))
    {
      SendClientMessage(playerid,c_r,"[ ! ] You cannot speak, you are not in-game !");
      return 0;
    }
    return 1;
}
Reply
#3

i thaught its normally like that
Reply
#4

On top of the script.
pawn Код:
new dontspeak[MAX_PLAYERS];
OnPlayerConnect
pawn Код:
dontspeak[playerid] = 1;
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(dontspeak[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't speak now, please spawn first!");
        return 0;
    }
    return 1;
}
OnPlayerSpawn
pawn Код:
dontspeak[playerid] = 0;
Reply
#5

Quote:
Originally Posted by |∞|-Рцппσĵσ-|∞|
On top of the script.
pawn Код:
new dontspeak[MAX_PLAYERS];
OnPlayerConnect
pawn Код:
dontspeak[playerid] = 1;
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(dontspeak[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't speak now, please spawn first!");
        return 0;
    }
    return 1;
}
OnPlayerSpawn
pawn Код:
dontspeak[playerid] = 0;
Thanks it worked , now to not make another Thread would you help me on also adding a no player command one?

Edit: thank you so much! your pro thanks
Reply
#6

For OnPlayerDisconnect you'd need
pawn Код:
dontspeak[playerid] = 1;
To reset the you cant talk on spawn?
Reply
#7

Quote:
Originally Posted by ilikepie2221
For OnPlayerDisconnect you'd need
pawn Код:
dontspeak[playerid] = 1;
To reset the you cant talk on spawn?
I dont know , i dont think so , i tried and it worked without it
Reply
#8

it worked but only for id 0 i think , when other players connect it does let t hem talk
Reply
#9

Quote:
Originally Posted by ilikepie2221
For OnPlayerDisconnect you'd need
pawn Код:
dontspeak[playerid] = 1;
To reset the you cant talk on spawn?
That's being done, when they connect to the server.

Quote:
Originally Posted by XeoN_13
it worked but only for id 0 i think , when other players connect it does let t hem talk
It should work for all players.
Reply
#10

Quote:
Originally Posted by XeoN_13
hello, does any one know how to prevent people from talking unless they spawn?
Simple:
pawn Код:
public OnPlayerText(playerid, text[])
{
  if(GetPlayerState(playerid) == 7) return SendClientMessage(playerid, 0xFFFFFFAA, "You must spawn first!");
  // 7 - Player is wasted or on class selection
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)