GameTextForPlayer
#1

It's very simple I guess (if you know it)
The code is as following:
PHP код:
public OnPlayerSpawn(playerid)
{
    
GameTextForPlayer(playerid"Welcome!"25003);
    return 
1;

Just very simple, when you login and spawn, it displays a message "Welcome" for 2 and an half second.
But somehow, when I die, i.e I type /kill, or /spawnplayer, I get that "Welcome" message again.
I just want that "Welcome" message when a player logs in and spawns.
Reply
#2

The welcome text is displayed when a player spawns. You can add a check to see if they have already seen the message, or move it to when a player connects instead.
Reply
#3

An easy way to get what you want is this:
pawn Код:
new
       bool:firstSpawn[MAX_PLAYERS];

public OnPlayerConnect(playerid) {
   firstSpawn[playerid] = false;
}

public OnPlayerSpawn(playerid)
{
    if(!firstSpawn[playerid]) {
        GameTextForPlayer(playerid, "Welcome!", 2500, 3);
        firstSpawn[playerid] = true;
    }

    return 1;
}
Reply
#4

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    GameTextForPlayer(playerid, "Welcome!", 2500, 3);
    return 1;
}
Onplayerspawn is called when u die, or spawn when you connect to the server.
Reply
#5

I get this;

Quote:

C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(109) : error 029: invalid expression, assumed zero
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(110) : warning 217: loose indentation
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(113) : warning 217: loose indentation
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(113) : error 029: invalid expression, assumed zero
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(121) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Reply
#6

my code? if yes, send lines (errors only) warnings u can fix, just put
pawn Код:
Removed
on your script top.
Reply
#7

Nope, it's been fixed.
StarPeens, thank you. I just had to put it under OnPlayerRequest
thanks, everyone too.

Quick question: Why does it work good under that Callback?
Reply
#8

Quote:
Originally Posted by StarPeens
Посмотреть сообщение
my code? if yes, send lines (errors only) warnings u can fix, just put
pawn Код:
#pragma tabsize 0
on your script top.
That is the worse thing to do, it isn't so hard to indent.

Quote:
Originally Posted by StarPeens
Посмотреть сообщение
OnPlayerRequestSpawn i not know much of she, but is one callback that is only called one time (you first connect to the server) already OnPlayerSpawn, is called when all times when one player born. Exemple, when u die, u will born, when you join on the server, you will born.
OnPlayerRequestSpawn isn't called only once, it's called whenever a player requests to spawn from Class Selection. If you hit F4, go to class selection, select a class and click spawn, OnPlayerRequestSpawn will be called and then OnPlayerSpawn will be called. OnPlayerSpawn is called whenever a player spawns.
Reply
#9

Quote:
Originally Posted by StarPeens
Посмотреть сообщение
my code? if yes, send lines (errors only) warnings u can fix, just put
pawn Код:
...
on your script top.
This code has been banned from the forum, it's not allowed to tell about it just so you know, since it does more bad than good.
Reply
#10

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
This code has been banned from the forum, it's not allowed to tell about it just so you know, since it does more bad than good.
Removed, i not connected to the news.
Sorry.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)