help please
#1

hi, i need /carwhisper command (/cw) please...
Thanks
Reply
#2

What is it with all the people requesting command like it's a script request forum...
You didn't even give a proper explanation of what your command is supposed to do.
Post whatever code snippet you already have.
If you're looking for a person to do it for you, this is the wrong place, look at here instead:
Looking for scripters/helpers? Post here!
Reply
#3

Quote:
Originally Posted by Adamoneoone
View Post
What is it with all the people requesting command like it's a script request forum...
You didn't even give a proper explanation of what your command is supposed to do.
Post whatever code snippet you already have.
If you're looking for a person to do it for you, this is the wrong place, look at here instead:
Looking for scripters/helpers? Post here!
Code:
CMD:cw(playerid, params[])
{
	static
		userid;
	if (sscanf(params, "u", userid))
		return SendSyntaxMessage(playerid, "/cw [text]");
	new string[128];
	for(new i = 0; i < MAX_PLAYERS; i ++)
    if(IsPlayerInVehicle(i, GetPlayerVehicleID(i)))
    SendClientMessage(playerid, COLOR_YELLOW, string);
	return 1;
}
But when I type /cw [text] in the car, nothing happens
Reply
#4

I don't exactly get what you're trying to achieve.
This part:
Code:
new string[128];
for(new i = 0; i < MAX_PLAYERS; i ++)
if(IsPlayerInVehicle(i, GetPlayerVehicleID(i)))
SendClientMessage(playerid, COLOR_YELLOW, string);
Won't do anything at all because:
• You create a string and send the player a message using that string, however you never format it or set its text if you will.
• The for loop is absolutely pointless, because in the end you never use the "i". Did you mean to write:
Code:
SendClientMessage(i, COLOR_YELLOW, string);
This part won't work either:
Code:
if (sscanf(params, "u", userid))
return SendSyntaxMessage(playerid, "/cw [text]");
You're trying to ask sscanf to look for a valid playerid (the "u" specifier is wrong), and you are expecting to check if it's a string or not.

Should be:
Code:
new string[128]; //or any size.
if (sscanf(params, "s[128]", string)) return SendSyntaxMessage(playerid, "/cw [text]");
And now, you don't need to redeclare a string.
I think you've got everything to get your code sorted.
Reply
#5

Firs you must get if player state if he is driver or passenger
pawn Code:
new pstate[128];
    switch(GetPlayerState(playerid))
    {
        case PLAYER_STATE_DRIVER: pstate = "Driver";
        case PLAYER_STATE_PASSENGER: pstate = "Passenger";
    }
Get player name and the state when sending a message

pawn Code:
new pname[MAX_PLAYER_NAME+1], msg[128];
GetPlayerName(playerid, pname, sizeof pname);

//format for sending message with player state and name and message
format(msg, 128, "%s %s (%d): %s", pstate, pname, playerid, msg);
Now loop then get player vehicle id before sending message so it'll only send to those who's in the car

pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerInVehicle(i, GetPlayerVehicleID(playerid)))
        {
            SendClientMessage(i, -1, msg);
        }
}
This is just a sample! don't just copy and paste.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)