Help with chats. Rp
#1

Hello!

I am scripting a rp GM. I am scripting it to learn. I am new to scripting and i dont know alot of things about it.
I have a problem with the chat. I want to edit global chat to a chat witch can be viewed in range of 20.
Can you tell me how to do it please?
Reply
#2

What do you mean by: Can be viewed in range of 20. ?
Reply
#3

i mean: people who are in range of 20 close to me can see it.

like this
pawn Код:
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
sorry. am noob on this so i dont know how it is called -.-
Reply
#4

use this
pawn Код:
forward ProxDetector(Float:radi, playerid, const string[],const color);
public ProxDetector(Float:radi, playerid, const string[],const color)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        new kMessage =0;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                {
                    SendClientMessage(i, color, string);
                    kMessage++;
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                {
                    SendClientMessage(i, color, string);
                    kMessage++;
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                {
                    SendClientMessage(i, color, string);
                    kMessage++;
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                {
                    SendClientMessage(i, color, string);
                    kMessage++;
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                {
                    SendClientMessage(i, color, string);
                    kMessage++;
                }
            }
        }
        if(kMessage == 1)
        {
        SendClientMessage(playerid,0xFFFFFFFF,"( ! ) Nobody is around to hear you");
        }
    }//not connected
    return 1;
}
I use it in my rpg gm, I edited it a bit, now working more faster and more easy to use, use here
pawn Код:
public OnPlayerText(playerid, text[])
{
new string[256];
format(string,256,"%s: %s",PlayerName(playerid),text);
ProxDetector(20.0,playerid,string,GetPlayerColor(playerid));
return 0; // here should be zero but no one
}
this will send player's message to everybody who arond 20 radian
if you need more scripts like this then I can offer you some of them
Код:
native CleanPlayerChat(playerid);
native CheckIPAdversting(string[]);
native GetPlayerID(const name[]);
native GetPlayerIDFromIP(ip[]);
native GetPlayerVehicleSpeed(playerid);
native GetPlayerTownName(playerid);
native GivePlayerArmour(playerid,Float:armour);
native GivePlayerArmourEx(playerid,Float:armour);
native GivePlayerDrunkLevel(playerid,level);
native GivePlayerHealth(playerid,Float:health);
native GivePlayerHealthEx(playerid,Float:health);
native GivePlayerScore(playerid,score);
native GivePlayerWantedLevel(playerid,level);
native HexToInt(string[]);
native IsMail(string[]);
native IsPlayerInArea(playerid,Float:max_x, Float:min_x, Float:max_y, Float:min_y);
native IsPlayerMoving(playerid);
native IsVehicleMoving(vehicleid);
native PlayerName(playerid);
native PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
native ProxDetector(Float:radi, playerid, const string[], color);
native SendClientMessageToAllEx(playerid,color,const string[]);
native StopPlayerSound(playerid);
native intstr(variable);
native strfloat(Float:float);
native split(const strsrc[], strdest[][], delimiter);
native strmatch(const string1[], const string2[]);
native strrest(const string[], &index);
native strtok(const string[], &index,seperator=' ');
native udb_hash(buf[]);
almost all is made by me or edited by me to make more easy to use or faster to work
Reply
#5

i will try this later. thanx alot. +Rep
Reply
#6

wow i get this errors
pawn Код:
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(236) : error 021: symbol already defined: "ProxDetector"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(236) : error 025: function heading differs from prototype
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(237) : error 021: symbol already defined: "ProxDetector"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(239) : error 010: invalid function or declaration
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(245) : error 021: symbol already defined: "GetPlayerPos"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(246) : error 010: invalid function or declaration
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(248) : error 010: invalid function or declaration
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(255) : error 010: invalid function or declaration
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(260) : error 010: invalid function or declaration
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(265) : error 010: invalid function or declaration
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(270) : error 010: invalid function or declaration
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(275) : error 010: invalid function or declaration
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(282) : error 010: invalid function or declaration
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(287) : error 010: invalid function or declaration
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(289) : warning 203: symbol is never used: "kMessage"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(289) : warning 203: symbol is never used: "oldposx"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(289) : warning 203: symbol is never used: "oldposy"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(289) : warning 203: symbol is never used: "oldposz"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(289) : warning 203: symbol is never used: "posx"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(289) : warning 203: symbol is never used: "posy"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(289) : warning 203: symbol is never used: "posz"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(289) : warning 203: symbol is never used: "tempposx"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(289) : warning 203: symbol is never used: "tempposy"
D:\Next Generation Roleplay\Next Generation Roleplay\gamemodes\Untitled.pwn(289) : warning 203: symbol is never used: "tempposz"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


14 Errors.
Reply
#7

folder is called next generation but look
pawn Код:
\gamemodes\Untitled.pwn(289)
EDIT: Reply For aslan890
Reply
#8

Made by you? Oh, it's nice to have you back FeaR!

@OP: You are learning, so you should be asking for guidance. If someone is to simply post code (especially without explaining it) as them for an explanation so you can learn. I don't suggest you use the ProxDetector function, or frankly any that mineralo is claiming to make, as they're all outdated.

To address your original question, you will need to use the OnPlayerText callback. Returning 0 to the function will result in the original text that the player typed not being sent to the other clients, which is what you will need to do (so you can create and send your own). As for the detection of the players nearby, simply use a player loop (foreach, if you haven't already looked into it) and use the IsPlayerInRangeOfPoint function to check if the current iterated player is within 20 units of the original sender (playerid, pass to OnPlayerText).
Reply
#9

Mineralo & virusa1 I make sure you both will get banned NEXT GENERATION ROLE PLAY IS ILLEGAL!!! YOU NOT THE OWNER SO YOU CAN'T GET ANY HELP FOR THAT AND Mineralo i will report you for helping that guy. Stealing somone else mod its illegal i make sure you both get banned
Reply
#10

Quote:
Originally Posted by aslan890
Посмотреть сообщение
Mineralo & virusa1 I make sure you both will get banned NEXT GENERATION ROLE PLAY IS ILLEGAL!!! YOU NOT THE OWNER SO YOU CAN'T GET ANY HELP FOR THAT AND Mineralo i will report you for helping that guy. Stealing somone else mod its illegal i make sure you both get banned
its named steal if take a function from other guy and edit it to make more better? lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)