SA-MP Forums Archive
OnPlayerStreamIn/Out weard error - 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: OnPlayerStreamIn/Out weard error (/showthread.php?tid=298975)



OnPlayerStreamIn/Out weard error - MathijsS - 23.11.2011

Hello,
I made a 'script' for 'OnPlayerStreamIn/out'
here is the code:
Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
    PlayerPlaySound(playerid, 1083, 0.0, 0.0, 10.0);
    new PlayerName[MAX_PLAYER_NAME],
    string[128];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "[STREAM-IN]{FFFFFF} %s.", PlayerName);
    SendClientMessageToAll(COLOR_ORANGE, string);
    return 1;
}
//----------------------------------------------------------
public OnPlayerStreamOut(playerid, forplayerid)
{
    PlayerPlaySound(playerid, 1084, 0.0, 0.0, 10.0);
    new PlayerName[MAX_PLAYER_NAME],
    string[128];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "[STREAM-OUT]{FFFFFF} %s.", PlayerName);
    SendClientMessageToAll(COLOR_ORANGE, string);
    return 1;
}
The weard thing is, if there is a NPC by me, it plays the sound. And alll the other time, it will send just random the message's. Even if their is no npc at all. I don't now whats wrong, i don't now how to fix it. I hope you can help me.
Sorry for my bad english. MathijsS


Re: OnPlayerStreamIn/Out weard error - Kostas' - 23.11.2011

I didn't understand so much, what do you need to make.
But as I saw to check if there is NPC
pawn Код:
// public OnPlayerStream In/Out (playerid, forplayerid)
{
    if (IsPlayerNPC(playerid))
    {
        // Code Here
    }
    return 1;
}



Re: OnPlayerStreamIn/Out weard error - MathijsS - 23.11.2011

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
I didn't understand so much, what do you need to make.
But as I saw to check if there is NPC
pawn Код:
// public OnPlayerStream In/Out (playerid, forplayerid)
{
    if (IsPlayerNPC(playerid))
    {
        // Code Here
    }
    return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerStreamIn
It will send me a message when a player will be streamt by me. That's when a player is in my district. Butt it does'nt work... Why?


Re: OnPlayerStreamIn/Out weard error - Babul - 23.11.2011

if a player streams in/out, the text gets sent to all players...
Код:
SendClientMessageToAll(COLOR_ORANGE, string);
...which will spam the chat with just a few players, try:
Код:
SendClientMessage(playerid,COLOR_ORANGE, string);
..to send the stream-text to 1 playerid.


Re: OnPlayerStreamIn/Out weard error - MathijsS - 23.11.2011

Quote:
Originally Posted by Babul
Посмотреть сообщение
if a player streams in/out, the text gets sent to all players...
Код:
SendClientMessageToAll(COLOR_ORANGE, string);
...which will spam the chat with just a few players, try:
Код:
SendClientMessage(playerid,COLOR_ORANGE, string);
..to send the stream-text to 1 playerid.
well, what you sayt works. Now i have another problem. He shows only my name. Not the name of the other player. Can you fix that?


Re: OnPlayerStreamIn/Out weard error - MathijsS - 23.11.2011

Can anyone help me?