[HELP]World
#1

Help, how to make a world system, messages sent will receive only those in my own world ?

I tried to do it myself but I could not...
Reply
#2

well show your code and we will try fix it.
Reply
#3

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
well show your code and we will try fix it.
OnPlayerText

Код:
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
            {
                 // ...
            }
            return 0;
        }
    }
Reply
#4

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
            {
                new str[128];
                format(str, sizeof(str), "%s says: %s", GetPlayerName(playerid), text);
                SendClientMessage(i, -1, str);
            }
            return 0;
        }
    }
EDIT:Changed params to text. Should work now.
Reply
#5

your on your way!

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
            {
                 SendClientMessage(i,-1,text);
            }
        }
    }
return 0;
of course youll want to format the message with the senders name.
and return 0 at the end of the callback.
Reply
#6

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
            {
                new str[128];
                format(str, sizeof(str), "%s says: %s", GetPlayerName(playerid), text);
                SendClientMessage(i, -1, str);
            }
            return 0;
        }
    }
EDIT:Changed params to text. Should work now.
other methods
?
Reply
#7

What kind of other method would you want? Lol?
Reply
#8

whats wrong with that, besides where he has the return 0;
that should be at the end of the callback not in the loop...


and GetPlayerName(playerid) cannot be used like that
Reply
#9

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
What kind of other method would you want? Lol?
now the code works perfectly?
Reply
#10

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
whats wrong with that, besides where he has the return 0;
that should be at the end of the callback not in the loop...


and GetPlayerName(playerid) cannot be used like that
1st, I didn't put the return there, he did. 2nd...Yea I know..It's really early here, and I haven't slept all night..

pawn Код:
new name[24];
GetPlayerName(playerid, name, sizeof(name));
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
            {
                new str[128];
                format(str, sizeof(str), "%s says: %s", name, text);
                SendClientMessage(i, -1, str);
            }
        }
    }
    return 0;
Should work now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)