SA-MP Forums Archive
onplayerconnect question - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: onplayerconnect question (/showthread.php?tid=92002)



onplayerconnect question - XeoN_13 - 18.08.2009

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?


Re: onplayerconnect question - coole210 - 18.08.2009

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



Re: onplayerconnect question - XCultz - 18.08.2009

i thaught its normally like that


Re: onplayerconnect question - Djiango - 18.08.2009

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;



Re: onplayerconnect question - XeoN_13 - 18.08.2009

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


Re: onplayerconnect question - ilikepie2221 - 18.08.2009

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


Re: onplayerconnect question - XeoN_13 - 18.08.2009

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


Re: onplayerconnect question - XeoN_13 - 18.08.2009

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


Re: onplayerconnect question - Djiango - 18.08.2009

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.


Re: onplayerconnect question - Correlli - 18.08.2009

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;
}