Car Chat - Need help
#1

I've been trying to make a car-chat command, where everything said is only visible to people inside the car if you do /cw [TEXT]. And I just haven't been able to do it. Could I get some help?
Reply
#2

Search function used ? i guess there are a lot of Scripts which uses things like that
Reply
#3

pawn Код:
// Put this somewhere in your FS/GM, aslong its not inside { }
SendCarMessage(color, text[])
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInAnyVehicle(i) && IsPlayerConnected(i))
        {
            SendClientMessage(i, color, text);
        }
    }
    return 0;
}

//In your command add this:
SendCarMessage(color, text[])
Tell me if there are any errors
Reply
#4

pawn Код:
// Put this somewhere in your FS/GM, aslong its not inside { }
SendCarMessage(carid, color, text[])
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInVehicle(i, carid) && IsPlayerConnected(i))
        {
            SendClientMessage(i, color, text);
        }
    }
    return 0;
}

//In your command add this:
SendCarMessage(carid, color, text[])
the last code would send to all players that are in any vehicle
Reply
#5

I just need a command that will send whatever an X player types to all players in THAT vehicle. Using this command line:

if(strcmp(cmdtext, "/cw", true) == 0)
Reply
#6

look in this (Click me) script and you will find it
Reply
#7

I post it for you if you don't want to search ^^
pawn Код:
if(strcmp(cmd,"/cw",true)==0)
    {
    if(IsSpawned[playerid] == 0) {
    SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
    return 1;
    }
    if(!IsPlayerInAnyVehicle(playerid)) {
    SendClientMessage(playerid, COLOR_ERROR, "You not in any vehicle. You cannot use this command");
    return 1;
    }
   
    if(strlen(cmdtext) <= 4) {
    SendClientMessage(playerid,COLOR_ERROR,"USAGE: /cw (msg)");
    return 1;
    }
    new cwhisperid = GetPlayerVehicleID(playerid);
    new output[150];
    new pname[24];
    GetPlayerName(playerid, pname, 24);
    strmid(output,cmdtext,3,strlen(cmdtext));
    format(string, sizeof(string), "(CAR WHISPER): %s(%d) %s",pname,playerid,output);
    printf("%s", string);
    for(new i=0;i<MAX_PLAYERS;i++)
    {
    if(IsPlayerInAnyVehicle(i))
    {
    if(GetPlayerVehicleID(i) == cwhisperid)
    {
    format(string, sizeof(string), "(CAR WHISPER): %s(%d) %s",pname,playerid,output);
    SendClientMessage(i,COLOR_YELLOW,string);
    }
    }
    }
    return 1;
    }
Reply
#8

Quote:
Originally Posted by xerox8521
Посмотреть сообщение
look in this (Click me) script and you will find it
Telling me to look in a script with almost 18 thousand lines of code doesn't help. At all.
Reply
#9

I posted the command just before you post
Reply
#10

Quote:
Originally Posted by HammerSmith
Посмотреть сообщение
Telling me to look in a script with almost 18 thousand lines of code doesn't help. At all.
And opening a thread instead of using the seach function either
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)