Vehicle Chat
if(strcmp(cmd, "/vc", true) == 0)
{
new string[256], sendername[24];
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid, COLOR_RED, "KORREKTUR: /vc [text]");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Du musst in einem Fahrzeug sein!");
format(string, sizeof(string), "(( Vehicle Chat(%s): %s ))", sendername, result);
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInVehicle(i, GetPlayerVehicleID(playerid)))
{
SendClientMessage(i,COLOR_BLUE, string);
}
}
}
return 1;
}